What are some common keyboard shortcuts for Linux?
These shortcuts are from the Linux Newbie Administrator Guide by Stan, Peter and Marie Klimas.
Switch to the first text terminals. Under Linux you can have several (6 in standard setup) terminals opened at the same time. This is a keyboard shortcut, which means: "press the control key and the alt key, hold them. Now press <F1>. Release all keys."
Switch to the nth text terminal. (The same could be accomplished with the rarely used command chvt n. "chvt" stands for "change virtual terminal"). In text terminal (outside X), you can also use <Alt><Fn> (the key <Ctrl> is not needed).
Print the name of the terminal in which you are typing this command. If you prefer the number of the active terminal (instead of its name), it can be printed using the command fgconsole (="foreground console").
Switch to the first GUI terminal (if X-windows is running on the 7th terminal, where it typcially is).
Switch to the nth GUI terminal (if a GUI terminal is running on screen n-1). On default, the first X server is running on terminal 7. On default, nothing is running on terminals 8 to 12--you can start subsequent X server there.
(In a text or X terminal) Autocomplete the command if there is only one option, or else show all the available options. On newer systems you may need to press <Tab><Tab>. THIS SHORTCUT IS GREAT, it can truly save you lots of time.
(In a text or X terminal) Scroll and edit the command history. Press <Enter> to execute a historical command (to save on typing).
Scroll terminal output up. This works also at the login prompt, so you can scroll through your bootup messages. The amount/usage of your video memory determines how far back you can scroll the display. <Shift><PgDown> scrolls the terminal output down.
(in X-windows) Change to the next X-server resolution (if you set up the X-server to more than one resolution). For multiple resolutions on my standard SVGA card/monitor, I have the following line in the file /etc/X11/XF86Config (the first resolution starts on default, the largest resolution determines the size of the "virtual screen"):
Modes "1024x768" "800x600" "640x480" "512x384" "480x300" "400x300" "1152x864"Z Of course, first I had to configure the X server, either by using Xconfigurator, xf86config, or manually by edition the file /etc/X11/XF86Config, so that it supports the above resolutions (mostly the matter of uncommenting the line that defines my video chipset, and specifying the synchronization frequencies my monitor supports). See also the commands xvidtune and xvidgen.
(in X-windows) Change to the previous X-server resolution.
(in X-windows, KDE) Kill the window I am going to click with my mouse pointer (the pointer changes to something like a death symbol). Similar result can be obtained with the command xkill (typed in X-terminal). Useful when an X-window program does not want to close (hangs?).
(in X-windows) Kill the current X-windows server. Use if the X-windows server cannot be exited normally.
(in text terminal) Shut down the system and reboot. This is the normal shutdown command for a user at the text-mode console. Don't just press the "reset" button for shutdown!
Kill the current process (works mostly with small text-mode applications).
(pressed at the beginning of an empty line) Log out from the current terminal. See also the next command.
Send [End-of-File] to the current process. Don't press it twice else you also log out (see the previous command).
Stop the transfer to the terminal.
Resume the transfer to the terminal. Try if your terminal mysteriously stops responding. See the previous command.
Send the current process to the background.
Logout. I can also use logout for the same effect. (If you have started a second shell, e.g., using bash, this command will make you exit the second shell, and you will be back in the first shell, not logged out. Then use another exit to logout.)
Restore a screwed-up terminal (a terminal showing funny characters) to default setting. Use if you tried to "cat" a binary file. You may not be able to see the command as you type it, but it still will work.
Paste the text which is currently highlighted somewhere else. This is the normal "copy-paste" operation in Linux. It a fast and powerful supplement to the widely-known GUI "copy-paste" menu-based operation. (It doesn't work inside older versions of Netscape which use the Mac/MS Windows-style "copy-paste" exclusively. It does work in the text terminal if you enabled "gpm" service using "setup". It also works inside any dialog boxes, etc.--really convenient!) It is best used with a Linux-ready 3-button mouse (Logitech or similar) or else set "3-mouse button emulation". The <MiddleMouseButton> is normally emulated on a 2-button mouse by pressing both mouse buttons simultanously.
(tilde character) My home directory (normally the directory /home/my_login_name). For example, the command cd ~/my_dir will change my working directory to the subdirectory "my_dir" under my home directory. Typing just "cd" alone is an equivalent of the command "cd ~". I keep all my files in my home directory.
(dot) Current directory. For example, ./my_program. will attempt to execute the file "my_program" located in your current working directory.
(two dots) Directory parent to the current one. For example, the command cd.. will change my current working directory one one level up.
Some additional KDE keyboard shortcuts (useful, but non-essential)
Walk through windows.
Walk backwards through windows
Walk through desktops
Walk backwards through desktops
Show the table of processes running on my system. Allow me to kill any of the processes I started (or send other signals to them).
Access the K-menu ("Equivalent toMS Windows "Start" menu).
Emulate the mouse using the arrow keys on the keyboard.
Drag a window to move it. Normally, I move a window by dragging its top title bar, but occasionally I manage to get it off the screen. With this shortcut, I can drag by any part of the window.
Take a snapshot of the current window into the clipboard.
Take a snapshot of the entire desktop into the clipboard.
Lock the desktop.
Toggle hide/show the desktop (great to hide the Solitaire game when your boss walks in).
(Non-essential.) This is a group of key combinations implemented at the Linux kernel level (a low level). It means, chances are these key combinations will work most of the time. The combinations are meant for debugging purposes and in an emergency (mostly developers); you should try other, safer solutions first. The key <SysRq> is also knows on PC as <PrintScreen>. The combinations can be enabled/disabled by setting the relevant kernel variable to "1" or "0", e.g. : echo "1" > /proc/sys/kernel/sysrq
Kill all processes (including X) which are running on the currently active virtual console. This key combination is know as "secure access key" (SAK).
Send the TERM signal to all running processes except init, asking them to exit.
Send the KILL signal to all running processes except init. This may be more successful in killing runaway processes than the previous key combination, but it may cause some of them to exit abnormally.
Send the KILL signal to all processes, including init. The system will not be functional.
Run an emergency sync (cache write) on all mounted filesystems. This can prevent data loss.
Remount all mounted filesystems as read-only. This has the same effect as the sync combination above, but with one important benefit: if the operation is successful, fsck won't have to check all filesystems after a computer hardware reset.
Turn off keyboard raw mode. This can be useful when your X session hangs. After issuing this command you may be able to use <CTRL><ALT><DEL>.
Reboot immediately without syncing or unmounting your disks. Your will likely end up with filesystem errors.
Shut the system off (if configured and supported).
Dump the current registers and flags to your console.
Dump a list of current tasks and their information to your console.
Dump memory info to your console.
The digit is '0' to '9'. Set the console log level, controlling which kernel messages will be printed to your console. For example, '0' will cause only emergency messages like PANICs or OOPSes displayed on your console.
Display help. Also, any other unsupported <Alt><SysRq><key> combination will display the same help.