Day One: TLCL_1_Cursor&Searching

Expansion & quoting:

Echo: display a line of text /  It prints out its text arguments on standard output / this is not a real command, but instead of others, like ls, cd, etc.

  • echo D* -> Desktop Download
  • echo *s -> aps.txt abs.txt
  • echo /usr/*/bin -> /usr/a/bin /usr/b/bin
  • echo $((arthimetic expression)) //ex: echo $((2+2)) -> 4
  • echo Number{1..5} or echo Alphabeta{A..D} -> Number1 Number2 … or AlphabetaA AlphabetaB (This is for creating a serious of diretories or files less larboriously, ex mkdir Number{1..5} -> Number1 Number2 Number3 …
  • echo $(command) , ex: ls -l $(which cp): pass the results of which cp as an argument to the ls command echo $(command) = echo `command` (back quote)
  • echo ‘arguments’ -> display the whole expansion
  • echo “arguments \$” -> display the whole expansion and the $

Cursor movement commands:

  • Ctrl + a: move cursor to the beginning of the line.
  • Ctrl + e: move the cursor to the end of the line.
  • Ctrl + f: move the cursor to the forward one character.
  • Ctrl + b: move the cursor to the backward one character.
  • Alt + f: move the cursor to the forward one word.
  • Alt + b: move the cursor to the backward one word.
  • Ctrl + l: clear up the lines above and put the cursor at the end of the line.
  • Ctrl + d: delete the character.
  • Ctrl + t: Transpose the character at the cursor location with the one preceding it -> ~ $ abc ~ $ bac
  • Alt + t: Transpose the word at the cursor location with the one preceding it. -> ~ $ abc def ~ $ def abc
  • Alt – l: Convert the characters from the cursor location to the end of the word to lowercase.
  • Alt – u: Convert the characters from the cursor location to the end of the word to uppercase.
  • Ctrl + k: kill from the cursor to the end of the line.
  • Ctrl + u: kill from the cursor to the beginning of the line.
  • Alt + d: kill from the cursor to the end of the word.
  • Alt + Backspace: kill from the cursor to the previous word.
  • Ctrl + y: yank text from the kill-ring.

History searching:

  • history | less -> 1 patthen \n 2 patthen
  • !# -> execute the command
  • Crtl + r: -> (reverse-i-search)“: display the text you are interested
    • Ctrl + j: copy the text in the current line
    • Enter: execute immediately
  • Ctrl + p: display the previous line.
  • Ctrl + n: display the next line.
  • !! -> repeat the last command.

What I learn today is how to play with the cursor and historical searching more rapidly.

Bookmark: 113

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s