30 useful Linux terminal keyboard shortcuts

In this post we will know about 30 useful Linux terminal keyboard shortcuts.The Linux keyboard shortcuts make your work on terminal very easy.We have tried to gather some useful Linux terminal keyboard shortcuts which can be run in system terminal as well as accessing machine with ssh command(Means through ssh terminal in short).
The given below shortcut keys has been tested in CentOS,Red Hat,Debian and Ubuntu.Most of the shortcut keys will also work in other Linux Distro

Linux terminal keyboard shortcut

Ctrl+L Clear the screen
tab Tab key autocomplete the name of command/file/directory etc. For eg. type tou and type tab

UP ARROW Key Shows you previous command in descending order
DOWN Arrow Key When you are using UP ARROW Key to get previous command.Then try this DOWN Arrow,it will show forward command history

Ctrl+R It is for Reverse search.Press CTRL+R and type some command which you last run.It will search for last command you run.
Here we pressed CTRL+r then typed /etc ,it automatically searched for command

(reverse-i-search)`/etc': /etc/init.d/httpd restart

Ctrl+J It end the CTRL+r search
Ctrl+G It abort the search by CTRL+r ( and restores original line)

CTRL+p It shows previous history,same like UP arrow key
CTRL+n It shows forward history,same like DOWN arrow key

Ctrl+B Move cursor one character to the left side
Ctrl+F Move cursor one character to the right side
Ctrl+A Move cursor to start of the line
Ctrl+E Move cursor to end of the line
HOME Move cursor at the start of the line
END Move cursor at the end of the line
CTRL+ RIGHT ARROW Move cursor one word right hand side
CTRL + RIGHT ARROW Move cursor one word left hand side
Ctrl+U It cut everything from the line start to cursor
Ctrl+K It cut everything from the cursor to end of the line
Ctrl+W It cut the current word before the cursor
Ctrl+Y It paste the previous cut text
CTRL+k It cut the line from the position of the cursor to the end of the line.
CTRL+SHIFT+c To copy selected text
CTRL+SHIFT+v To paste you last copied by CTRL+SHIFT+c
SHIFT + INSERT Copy selected text to clipboard and paste from the clipboard

Shift+PgUp/PgDown It Scrolls console buffer up/down. You can use this key, also in Runlevel 3 or terminal mode

CTRL+z Put the running process in background.(To get back, run jobs command.And then foregorund it by using fg command. )
For example. First run the top then press CTRL+z.After this use fg command and found job no. 1 for top. See below example

linux@tuxworld:~/Desktop$ jobs
[1]+  Stopped                 top
linux@tuxworld:~/Desktop$ fg %1

Ctrl + T It swap the last two characters before the cursor
Esc + T It swap the last two words before the cursor

CTRL+m It is like a Enter key (If ENTER key do not work,try this)

And at the end….

Ctrl + D Log out of current session, like exit command

3 thoughts on “30 useful Linux terminal keyboard shortcuts”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.