Unix Blog !

November 19, 2007

Linux keyboard shortcuts.

Filed under: Unix Commands — sriram003 @ 12:17 pm

Linux has many keyboard shortcuts. Knowing them makes using Linux much easier.

Console/terminal

  • CtrlAltDelete – shuts down computer
  • AltFn (F1, F2, F3,…) – switch to n-th console
  • AltLeft or AltRight – switch to next/previous virtual terminal
  • Scroll Lock – locks terminal input/output – allows to read console contents when output is going too fast. To unlock, press Scroll Lock once again.
    Alternatively, Scroll Lock can be enabled using CtrlS and disabled with CtrlQ. Try last shortcut if your console hangs for unknown reason – it happened to me many times that I’ve locked it accidentaly by pressing CTRLS.
  • ShiftPage Up and ShiftPage Down – scrolls console buffer up/down. Works also when Scroll Lock is enabled. After changing the terminal (AltFn) buffer contents is erased and it is impossible to scroll it.
  • CtrlL – screen refresh
  • CtrlC or CtrlBackslash – kills current task
  • CtrlD – stands for EOF (End-of-file). If you type it on en empty command line, it will quit bash. This is so much faster than typing exit
  • CtrlZ – pause process. Use commands: bg to run in background or fg to run in foreground.


Bash & command-line

  • CtrlA – moves cursor to beginning of command line.
  • CtrlE – moves cursor to end of command line.
  • CtrlK – clears command line from cursor position to end of line.
  • CtrlU – clears command line from cursor position to beginning of line.
  • CtrlW – clears word to the left
  • CtrlY – will paste in anything that was deleted by CtrlU or CtrlK or CtrlW
  • Tabcommand-line autocompletion. Automatically completes current command line.
    If autocompletion script is enabled, then also options and applications parameters are autocompleted.
  • CtrlR – followed by characters will do a incremental search of the previous command history

Kernel shortcuts

Following shortcuts must be enabled in kernel, they also must be enabled using proc interface (echo 1 > /proc/sys/kernel/sysrq).

  • AltSysRQS – sync all mounted filesystem. Data in buffers is immediately written to disks.
  • AltSysRQU – remounts mounted filesystems read-only
  • AltSysRQB – performs immediate reboot. Don’t do it without syncing and unmounting as it can cause massive filesystem corruption
  • AltSysRQS, then AltSysRQU, then AltSysRQB – attempts to sync all mounted filesystems, remounts them read-only and immediately reboots computer. Fastest way to reboot Linux.
  • AltSysRQH – prints out list of other SysRQ functions.

X-Windows shortcuts

  • CtrlAltPlus or CtrlAltMinus– changes screen resolution (higher/lower). Only if X-Windows server is configured for multiple resolutions.
  • CtrlAltBackspace – kill X-server. Running applications will be terminated.
  • CtrlAltEscapexkill – click an application to kill it.
  • CtrlShiftNum Lock will turn the keypad on the keyboard into the mouse, so you can control the mouse from keyboard. Keys / and * on the numpad select left mouse click and right mouse click respectively. Mouse click is done by 5 on the numpad.
  • CtrlAltFn (F1, F2, F3,…) – switches to n-th text console.

KDE shortcuts

  • CtrlAltShiftPage Down – direct shutdown
  • CtrlAltShiftPage Up – direct reboot
  • AltF2 – Starts the run command box. Type a application executable to launch it, folder name to open it, filename to use an appropriate program to launch it, url to go to it in konqueror and any of the numerous web shortcuts(gg, wp) defined by konqueror to activate them.

Do you know any other shortcuts that are worth to know?

Create a free website or blog at WordPress.com.