Speeding up work at Linux command line part # 1
Working at shell prompt is an essential task for any Linux system administration. However many newcomers find it difficult to work at bash prompt. Here are some tricks to speed up your work.
(A) Shortcut keys for command editing:
CTRL+L : Clear the screen
CTRL+R : To search for a command in command history. For example yesterday or few hourse back you typed 'a very very long command' and you need same command again. Then hit CTRL+R and type first few letters of command.
CTRL+C : Cancel command
CTRL+Z : Suspend command
CTRL+T : transpose characters. For example by misspelled command date:
$ daet
Sure you can rub the last two character and retype it again, but wait just hist CTRL+T and you are done:
$ daet [CTRL+T]
Result into character transpose:
$ date
ALT+T OR ESC+T: transpose words. For example you typed:
$ filename rm
To correct it just hit ALT+T
$ filename rm [ALT+T]
And you have correct command to remove a file.
$ rm filename
CTRL+U : Deletes entire line
CTRL+K : Deletes to end of line from current cursor position
HOME OR CTRL+A : Moves cursor to beginning of line
END OR CTRL+E : Moves cursor to end of line
(B)Recall last argument from previous command – to save time
ALT+. (hold down ALT key and press period/dot)
For example first you typed the mkdir command as follows:
$ mkdir -p /tmp/demo/software/qtapp
Now you would like change directory to /tmp/demo/software/qtapp, then type cd and press ALT+.:
$ cd [PRESS alt+.]
(C) Command completion
Most of the Linux admin uses TAB key to complete command names and files names. So let us say you would like to mount something then:
i) Type word mo:
$ mo
ii) Hit TAB key to complete word
$ mo [TAB]
iii) And end result should be:
$ mount
(D) List the possible completions
BASH also supports the possible completions of commands or text (file). For example you would like to list all the possible command starts with ls command:
$ ls [ESC]
Will display following text (above the current command line)
ls lsmod lsmod.modutils lspci lsusb lsattr lsmod.Lmodutils lsof
Next time I will discuss more about advanced command line completions and other cool features.
E-mail this to a Friend
Printable Version
You may also be interested in other helpful articles:
- Create function keys based shortcut to speeding up work at Linux command line part # 2
- Find Out If Windows Server System Hacked / Cracked Or Not
- Linux gperf C and C++ command line processing programming tutorial
- UNIX Command Line And The History Of The Shell
- Understanding How Shellcodes Work
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!


Hmm that is cool, you can also read more shortcut keys in bash man page.