Gentoo Wiki


This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Terminal / Shell / Console Keyboard Shortcuts

Some keyboard shortcuts; these generally are patterned after readline's shortcuts. Not all of them work in all shells.

  • <ctrl> + a

Move cursor to the beginning of the line.

  • <ctrl> + e

Move cursor to the end of the line.

  • <ctrl> + d

to exit a shell. If this is your last shell, it will also either log you out or close the window if you're on X.

  • <ctrl> + r

To get reverse pattern search in your last used commands. Then type in what you are looking for. This function is "search as you type". To cycle through the found commands, press <ctrl>+r continuously. Return will execute the shown command, while escape will exit the search, copying the currently shown command to the command line. <ctrl>+c will just cancel it and give you an empty command line

  • <ctrl> + l

with l as in 'lemon' this will clear the whole display, leaving the command that is currently on your command line untouched.

  • <ctrl> + c

This clears the command line of anything you've typed. Good if you have a typo or simply changed your mind :) Also works at the login prompt if you misspelled or typed the wrong password.

  • <ctrl> + u

clears actually typed line from beginning of line to current position

  • <ctrl> + k

clears actually typed line from current position end of line

  • <ctrl> + w

Deletes the word before the cursor or if you are in a word it deletes the beginning of it.

  • <alt> + d

Cut the word under the cursor to a buffer.

  • <ctrl> + y

Insert content of buffer (see <alt> + d).

  • <alt> + f

Go a word forward.

  • <alt> + b

Go a word backwards.

  • <ctrl> + s

pause console output. The process keeps running.

  • <ctrl> + q

Resume console output paused with <ctrl> + s

  • <ctrl> + <shift> + c

Copy highlighted text.

  • <ctrl> + <shift> + v

Paste text at cursor

-- from Clemens ( 2004/11/16

If you use bash (probably in other shells too), you can use background and foreground:

  • <ctrl> + z

suspend current process and send it into background. Extremly useful to close an editor very quickly to check something or to send a started program into background. If the program should run in background, you'll have to "unsuspend" it with bg.

to get the program back to foreground:

  • fg

see more in `man jobs`

-- from ekutay 2005/05/18

If the <alt> key doesn't work as explained above, try to enable it in your .Xdefaults.

File: $HOME/.Xdefaults
XTerm*metaSendsEscape:   true

External links

Retrieved from ""

Last modified: Thu, 31 Jan 2008 12:37:00 +0000 Hits: 20,061