Basic Linux Keyboard Shortcuts

From LinuxReviews
Jump to navigationJump to search

The most common Linux keyboard shortcuts beginners should know

Use the tab[edit]

Tabulator is used to complete commands and filenames. The button is found on the left upper side of the keyboard and usually has two arrows (<- ->) and/or the text "Tab" on it.

If you are in a terminal and your current working folder (check with pwd) contains the folder Documents (check with ls) and you want to change into it (with cd) you can type

cd Doc and press tab to expand that into

cd Documents

If there are more than one folder beginning with Doc pressing tab will complete the first folder, sorted alphabetic. You can get all alternatives beginning with Doc by pressing tab a second time.

Tabulator work the same way with commands, but commands are not completed by the first tabulator press if there are more than one alternative. By typing gnome<tab><tab> you will get a list of all commands beginning with gnome.

Tab completion work with all file dialog boxes in KDE and Gnome and is a standard you will find that works with almost anything that asks you to give a filename or command. Tab is best pressed with the left little ("pinky") finger.

Shell shortcuts[edit]

Shortcut Function
ctrl-d exit a terminal, same as typing exit
ctrl-l clears the screen, same as clear
ctrl-c breaks/cancels an ongoing operation
ctrl-z pauses (stops) an ongoing operation. Type fg (foreground) to resume it or bg (background) to continue the process in the background
shift-up scrolls up, one line at a time
shift-PageUp scrolls up, one page at a time

cut and paste[edit]

You can highlight any text anywhere using the mouse and instantly paste it by pressing mouse button 3 (or both buttons on two button mouse).

Applications also support selecting text and pressing ctrl-c to copy it or ctrl-x to cut it to the clipboard. Press ctrl-v or `shift-insert` to paste.

screen[edit]

When using the terminal window manager screen you can enter "scroll back mode" with ctrl-a esc. In this mode you can mode the cursor with the arrows and mark text by pressing `space bar` at the beginning and end of the text you want. The text you selected can now be pasted with ctrl-a ].

I want to quit[edit]

Generally q (console) or in graphical programs ctrl-q (quit) or ctrl-x. Ctrl-w will close your the current window, but not the application if it has more windows.

Getting out of vi:

:q

ctrl-c may also do the job

/quit in irc clients

q or esc to quit pagers (more, less)

If you are desperate to quit a console application: ctrl-z then kill -9 %1 ; fg