Linux Keyboard_shortcuts

司徒俊雄
2023-12-01

Standard shortcuts

Kernel

There are several low level shortcuts that are implemented in the kernel which can be used for debugging and recovering from an unresponsive system. Whenever possible, it is recommended that you use these shortcuts instead of doing a hard shutdown (holding down the power button to completely power off the system).

To use these, they must first be activated with either sysctl kernel.sysrq=1 or echo "1" > /proc/sys/kernel/sysrq. If you wish to have it enabled during boot, edit /etc/sysctl.d/99-sysctl.conf and insert the text kernel.sysrq = 1. If you want to make sure it will be enabled even before the partitions are mounted and in the initrd, then add sysrq_always_enabled=1 to your kernel parameters.

A common idiom to remember this is "Reboot Even ISystem Utterly Broken" (also referred to as "REISUB"). Alternatively, think of it as "BUSIER" backwards.

Keyboard Shortcut Description
Alt+SysRq+r UnrawTake control of keyboard back from X.
Alt+SysRq+e TerminateSend SIGTERM to all processes, allowing them to terminate gracefully.
Alt+SysRq+i KillSend SIGKILL to all processes, forcing them to terminate immediately.
Alt+SysRq+s SyncFlush data to disk.
Alt+SysRq+u UnmountUnmount and remount all filesystems read-only.
Alt+SysRq+b RebootReboot
Tip:
  • If you are using a display manager and after Alt+SysRq+e you are presented with the login screen (or full desktop if autologin is enabled), it is most likely caused by Restart=always directive in the relevant service file. If necessary, edit the unit, however this should not prevent the "REISUB" sequence from working.
  • If all the above combinations work except Alt+SysRq+b, try using the contralateral Alt key.
  • On laptops that use Fn key to differentiate SysRq from PrtScrn, it may not actually be necessary to use the Fn key (i.e., Alt+PrtSc+letter could work).
  • On Lenovo laptops SysRq is often configured as Fn+S. To use it press and hold Alt then press Fn+srelease Fn and s still holding Alt followed by the keys above.
  • You may need to press Ctrl along with Alt. So for example, full key shortcut would be Ctrl+Alt+SysRq+b.

See Wikipedia:Magic SysRq key for more details.

Terminal

Virtual console

See Wikipedia:Virtual console

Keyboard Shortcut Description
Ctrl+Alt+DelReboots Computer (specified by the symlink /usr/lib/systemd/system/ctrl-alt-del.target)
Alt+F1F2F3, ...Switch to n-th virtual console
Alt+ ←Switch to previous virtual console
Alt+ →Switch to next virtual console
Scroll LockWhen Scroll Lock is activated, input/output is locked
Shift+PgUp/PgDownScrolls console buffer up/down
Ctrl+cKills current task
Ctrl+dInserts an EOF
Ctrl+zPauses current Task

Readline

GNU readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details of readline package under "Required By" for more examples). readline is also customizable (see man page for details).

Keyboard Shortcut Description
Ctrl+lClear the screen
Cursor Movement
Ctrl+bMove cursor one character to the left
Ctrl+fMove cursor one character to the right
Alt+bMove cursor one word to the left
Alt+fMove cursor one word to the right
Ctrl+aMove cursor to start of the line
Ctrl+eMove cursor to end of the line
Copy & Paste
Ctrl+uCut everything from line start to cursor
Ctrl+kCut everything from the cursor to end of the line
Alt+dCut the current word after the cursor
Ctrl+wCut the current word before the cursor
Ctrl+yPaste the previous cut text
Alt+yPaste the second latest cut text
Alt+Ctrl+yPaste the first argument of the previous command
Alt+./_Paste the last argument of the previous command
History
Ctrl+pMove to the previous line
Ctrl+nMove to the next line
Ctrl+sSearch
Ctrl+rReverse search
Ctrl+jEnd search
Ctrl+gAbort search (restores original line)
Alt+rRestores all changes made to line
Completion
TabAuto-complete a name
Alt+?List all possible completions
Alt+*Insert all possible completions

X11 & Wayland

Keyboard Shortcut Description Notes
Ctrl+Alt+F1F2F3, ...Switch to n-th virtual consoleIf it does not work, try Ctrl+Fn+Alt+F….
Shift+Insert 
Mouse Button 2
Paste text from the PRIMARY bufferBy default, Qt maps Shift+Insert to CLIPBOARD instead of the PRIMARY buffer (see e.g. [1]) and Ctrl+Shift+Insert is mapped to the PRIMARY buffer.

More reference: https://wiki.archlinux.org/index.php/Keyboard_shortcuts

 类似资料:

相关阅读

相关文章

相关问答