页面

2009-05-18

bash cheat sheet

  1. Bash keyboard shortcut:
    1. Ctrl + A: Go to the beginning of the line you are currently typing on
    2. Ctrl + E: Go to the end of the line you are currently typing on
    3. Ctrl + L: Clears the Screen, similar to the clear command
    4. Ctrl + U: Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
    5. Ctrl + H: Same as backspace
    6. Ctrl + R: Let's you search through previously used commands
    7. Ctrl + C: Kill whatever you are running
    8. Ctrl + D: Exit the current shell
    9. Ctrl + Z: Puts whatever you are running into a suspended background process. fg restores it.
    10. Ctrl + W: Delete the word before the cursor
    11. Ctrl + K: Clear the line after the cursor
    12. Ctrl + T: Swap the last two characters before the cursor
    13. Esc + T: Swap the last two words before the cursor
    14. Alt + F: Move cursor forward one word on the current line
    15. Alt + B: Move cursor backward one word on the current line
    16. Tab: Auto-complete files and folder names
  2. A good reference on how to manage jobs: Job Control

  3. online manual
  4. assign output of a command to a parameter (i.e. variable)
    var=$(command)
  5. assign result of a command to a parameter (i.e. variable)
    var=$((command))
  6. square bracket ('[' and ']') means test expression (see manual, section 'Bourne Shell Builtins'). There is a table of Bash Condition Expressions here.

没有评论: