Linux Bash Tips

 

Some of the better bash / linux terminal shortcuts.

 

Ctrl + a

Jumps to the start of the current command line.

 

Ctrl + e

Jumps to the end of the current command line.

 

Ctrl + c

Send a sig term to the current running program.

 

Ctrl + \

Terminate the current running program. This is different from "ctrl + c" as it does not ask the program to quit. It uses sig kill which kills the program.

 

Ctrl + s

This will pause the current output of the terminal so you can scroll backwards and read the output. The task will however block while trying to write to stdout.

 

Ctrl + q

This will resume the output after pausing it with "ctrl + s"

 

Ctrl + z

Suspends the current running task you can then resume the task later by using fg. Or fg <number> if you have multiple suspended tasks. You can also use bg to background a suspended task though I don't recommand this if the program is going to produce and output.

 

Ctrl + r

This an great shortcut. It will reverse search your hostory for any part of the command and show you the most recent that it found. If its not write you can keep searching by typing or press it again to skip over that item. This can lead to really fast usage and avoid trying to find the most recent command with the up arrow.

 

Ctrl + d

This is the same as sending a close on the input of the current process. This means you can do the following "cat >> TODO" type several things and press "ctrl + d" to close the input stream to cat. Bash will also treat this as typing "exit".

 

Tab

Does auto complete. It will search the path when you are typing the program to run. Otherwise it will search for the relitive path on the file arguments for which file to use. Pressing it a second time will list the avilable options matching the current command.

 

If you know any other greate shell shotcuts let me know. I will add them to the list.