Linux Terminal Shortcuts

Terminal Shortcuts

Taking Ubuntu as an example, others are similar

Shortcut Function
tab Auto-complete
ctrl+a Move cursor to the beginning
ctrl+e Move cursor to the end
ctrl+k Delete from cursor to the end
ctrl+u Delete from cursor to the beginning
ctrl+d Delete current character
ctrl+h Delete the character before the current character
ctrl+w Delete the word to the left of the cursor
ctrl+y Paste words deleted by ctrl+u, ctrl+d, or ctrl+w
ctrl+l Equivalent to clear, i.e., clear the screen
ctrl+r Search command history
ctrl+b Move cursor backward
ctrl+f Move cursor forward
ctrl+t Swap the character at the cursor with the previous character
ctrl+& Restore content deleted by ctrl+h, ctrl+d, or ctrl+w
ctrl+s Pause screen output
ctrl+q Resume screen output
ctrl+left-arrow Move cursor to the beginning of the previous word
ctrl+right-arrow Move cursor to the end of the next word
ctrl+p Show previous command from history
ctrl+n Show next command from history
ctrl+d Close terminal
ctrl+xx Move to the end of line and current cursor position
ctrl+x@ Show possible hostname completions
ctrl+c Terminate process/command
shift +up or down to scroll terminal
shift+pgup/pgdn Scroll up or down in terminal
ctrl+shift+n New terminal
alt+f2 Type gnome-terminal to open terminal
shift+ctrl+t Open a new tab
shift+ctrl+w Close tab
shift+ctrl+c Copy
shift+ctrl+v Paste
alt+number Switch to the corresponding tab
shift+ctrl+n Open a new terminal window
shift+ctrl+q Close terminal window
shift+ctrl+pgup/pgdn Move tabs left or right
ctrl+pgup/pgdn Switch tabs
f1 Open help guide
f10 Activate menu bar
f11 Toggle fullscreen
alt+f Open “File” menu
alt+e Open “Edit” menu
alt+v Open “View” menu
alt+s Open “Search” menu
alt+t Open “Terminal” menu
alt+h Open “Help” menu

Differences between ctrl-c, ctrl-z, and ctrl-d

  1. ctrl-c: (kill foreground process) Sends a SIGINT signal to all processes in the foreground process group, forcibly terminating the execution of the program.

  2. ctrl-z: (suspend foreground process) Sends a SIGTSTP signal to all processes in the foreground process group, commonly used to suspend a process rather than end it. The user can use <span>fg</span>/<span>bg</span> commands to resume execution of the foreground or background process.

    <span>fg</span> resumes the suspended process in the foreground, at which point you can use ctrl-z to suspend it again, <span>bg</span> resumes the suspended process in the background, at which point you cannot use ctrl-z to suspend it again, <span>jobs</span> to view.

    A commonly used feature:

    When using vi to edit a file and needing to execute a shell command to query some required information, you can use ctrl-z to suspend vi, execute the shell command, and then use fg to resume vi to continue editing your file (of course, you can also execute shell commands within vi using the !command method).

  3. ctrl-d: (Terminate input, or exit shell) A special binary value representing EOF, equivalent to entering exit and pressing enter in the terminal.

Leave a Comment