Bash shortcuts


Or: never do history | grep again!

The command line interface of the *nix systems is amazing and Windows doesn’t have anything that comes even close to it (although I still have to experiment with PowerShell – I like very much the base idea that instead of text lines you get objects with well defined properties and you don’t have to play the I check two cases and throw out a regular expression which will die in the particular cases game). A nice thing I discovered recently are the shortcut keys you can use:

Ctrl + A
Go to the beginning of the line you are currently typing on
Ctrl + E
Go to the end of the line you are currently typing on
Ctrl + L
Clears the Screen, similar to the clear command
Ctrl + U
Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H
Same as backspace
Ctrl + R
Let’s you search through previously used commands. This is the one that can replace the history | grep process.
Ctrl + C
Kill whatever you are running – proably a well known to everyone
Ctrl + D
Exit the current shell. Also known as end of stream – basically the shell terminates because you’ve said there will be no more input from here!
Ctrl + Z
Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W
Delete the word before the cursor
Ctrl + K
Clear the line after the cursor
Ctrl + T
Swap the last two characters before the cursor
Esc + T
Swap the last two words before the cursor
Alt + F
Move cursor forward one word on the current line
Alt + B
Move cursor backward one word on the current line
Tab
Auto-complete files and folder names

For more keyboard shortcut goodies, visit the following sites:

Or just search for bash shortcuts with your favorite search engine.

,

One response to “Bash shortcuts”

Leave a Reply

Your email address will not be published. Required fields are marked *