Tuesday 13 May 2014

Keyboard shortcuts within Terminal

terminal icon
Linux has evolved from the traditional command line interface to graphical user interfaces. There are various Linux desktop environments which support high resolution graphical way of handling everything with some clicks. However, there is a group of Linux users who still prefer the command line way of doing almost everything, the reason behind is that is faster and more powerful. Command line has been and will always be an integral and important part of any Linux distribution. In this article, I am sharing the keyboard shortcuts that you can use within the command-line terminal.

Starting a terminal.

You can start a terminal by searching it in the "Dash" in Unity desktop environment. In Gnome, navigate to Application Menu > Accessories > Terminal.

You can alternatively use Ctrl + Alt + T to open the terminal in almost every Linux distribution with any desktop environment.
Terminal WIndows

Keyboard shortcuts within Terminal.

The list do not cover the terminal commands but the keyboard shortcuts within a Terminal that can be used to handle the commands in an efficient way.

Enter   Run a command

Up Arrow   Show the previous command.

!$   Repeats the last argument of the previous command.

Ctrl-a   Move the cursor to the start of the line.

Ctrl-e   Move the cursor to the end of the line.

Alt-x   Move the cursor to the next occurrence of x.

Alt-Ctrl-x   Moves the cursor to the previous occurrence of x.

Ctrl-u   Delete everything from the beginning of the line to the cursor position.

Ctrl-k   Delete everything from the cursor position to the end of the line.

Ctrl-w   Delete from the cursor to the start of the word.

Ctrl-y   Paste texts from the clipboards.

Ctrl-t   Swap the two characters before the cursor.

Ctrl-l   Clear the screen with the current line at the top of the screen.

Ctrl-x Ctrl-u   Undo the last changes.

Ctrl-Alt-r   Undo all changes to the line.

Ctrl-Alt-e   Expand command line.

Ctrl-r   Allows you to type a part of the command you're looking for and finds it.

Alt-p   Non-incremental reverse search of the history.

!!   Execute last command in the history.

!abc   Execute last command in history beginning with abc.

!n   Execute nth command in history.

^abc^xyz   Replace first occurrence of abc with xyz in last command and execute it.  

Ctrl-d   Log out of current session, similar to exit

This is a list of the keyboard shortcuts you can use within a terminal to handle things in a better way. Try these gradually and you will save lot of time and effort.

Do I miss something? Please comment if you know some more keyboard shortcuts withing terminal which is not in the above list.

Update: +Jörg Linuxfreund pointed out that the Ctrl + Alt + T doesn't work in all Linux distributions/ desktop environments.

Opening a terminal in KDE. KDE comes with a console application Konsole. You will find it in Programs > System. You can try Alt + F2 which opens a small windows where you can type the application name konsole. In case Konsole is not there, you may try "xterm" that will do the same work for you.

Other Popular terminals for KDE are tilda and yakuake. You can download the stable release of yakuake here.


Post a Comment