Informative guide to useful Linux shortcuts
Using Linux means using command line interface aka CLI aka terminal on regular basis. Being good in using CLI is what separates a casual Linux user & an expert. In this tutorial, we will learn about some useful Linux shortcuts that can increase your efficiency as well as your productivity.
Recommended Read : Cloning Disks using dd & cat commands for Linux systems
Also Read : Use of du & df commands (with examples)
Useful Linux Shortcuts
Using history in bash
Most of you guys must be aware of this. We can run the command that we have already executed from terminal by navigating with UP arrow or DOWN arrow keys. Now what most people don’t know is that there are other ways to do the same, these are mentioned below
CTRL+L —This is a nice, important shortcut that every Linux user should know. When using CLI, if you want to look for a particular, you can use CTRL+L followed by the command keyword. For example, if we need to look for openvpn command, press CTRL+L & start typing openvpn & we should see the complete command in the terminal screen.
!123 – Running history command produces a list all the commands that were executed from the system, so if we want to run a particular command from the list, we should take note of the command number & than to execute the command, run
where 123 is the number in history when the command was executed.
!! – To use the last command again type !! . It comes extremely handy in scenario where you have forgot to use SUDO before the command, so use the following command without having to type whole command again
$ sudo !!
CTRL + P – Another way to access the last command in bash history is to use !-1 , where 1 is the last command in the history. If need to run second last command, than we can user !-2. CTRL+ P can also be used to view the last commands that were executed in bash. Pressing the key combination again & again will produce other commands from history.
Navigating the terminal
Now let’s discuss some more shortcuts that can be used to easily navigate the terminal.
Tab – Though technically not used for navigating the terminal, we can press TAB key to complete an incomplete linux command or other Linux arguments like filename, directory address etc.
CTRL+ALT+F1 (F1 to F6) – To shift between the terminals in Linux, press CTRL+ALT+F1 or F2 upto F6.
CTRL+Left or Right Arrow – We can use CTRL + Left key or CTRL + Right key to jump between the command arguments.
CTRL+A and CTRL+E – To get the cursor to the beginning of a line, press CTRL + A & to get cursor at the end of the line , press CTRL + E. Alternatively we can also use HOME & END button to accomplish the same.
CTRL+ W — To delete the word that is before the position of the cursor, press CTRL+W.
CTRL+K — To delete all the words from current position of cursor till end of the line, press CTRL + K.
CTRL+U – Delete an entire line of terminal using CTRL+U.
Working with system Processes
CTRL+Z – To send a running process to background, press CTRL+Z. Once in the background, we can bring the process to foreground by typing
but if you have sent a number of processes to background than we need to check the process number for the process we want in foreground. To do that type
& we should have list of all the process in background with a number. Now bring a process to foreground, type
$ fg 3
CTRL+C – Use this shortcut to kill a running process.
CTRL+S & CTRL+Q – To stop printing all output to screen, use CTRL+S & to start the output on screen again, press CTRL+Q.
Some other shortcuts
CTRL+L – To clear the complete terminal screen, use CTRL+L key combination.
CTRL+D – To logout or exit the bash shell, use CTRL+D.
This was our tutorial on useful Linux shortcuts that we should be aware of. I know this list is not complete & there are plenty more of the useful Linux shortcuts that can be used. Do mention your favourite Linux shortcuts in the comment box below.
If you have found this article to be useful, please share it among your friends/colleagues/followers. THANKS !!!