Being handy on a terminal can be an enormous productivity boost and will make you feel like a proper hacker (as long as you’re typing in green on a black background).
Bash is by far the most popular shell available on Linux based systems, packed with extensive customization options for any environment. In this post, I’ll line up some of the shortcuts that’ll make your life quite a bit easier.
Copying and pasting on command line
This one isn’t actually bash specific, but will work on basically any terminal emulator such as PuTTY or Xterm.
To copy:
ctrl+insert
To paste:
shift+insert
Cursor manipulation
Go to beginning of line:
ctrl+a
Go to end of line:
ctrl+e
Delete last word:
ctrl+w
Process control
Kill a running command:
ctrl+c
Move current process from running to sleeping state (mnemonic: zzz):
ctrl+z
After executing previous command, you can get it running again either in foreground or background by issuing the fg or bg command. In the latter case you’ll regain control of the terminal.
Exit bash:
ctrl+d
This is equivalent to typing exit, and is considered a “clean” exit and as such will not prompt a confirmation box.
Quick history
To quickly search in your history (instead of spamming the up arrow), simply use:
ctrl+r
And start typing the part of the command you remember. Be careful as pressing enter will execute the command in your history immediately.
Leave a Reply