Linux command line editing shortcuts - convenient for you and me

Table of contents

Command line shortcuts:

Commonly used:

Historical commands:

Command line editing:

other:

Scumbags (such as me) must feel that it is very inefficient to control the calculator by entering a string of characters when typing commands in the Linux command window (terminal).

The Linux command interpreter (Shell) has many shortcut keys, mastering them well can greatly improve the operation efficiency. The most commonly used shortcut keys are listed below, this is not the full version yet.

Command line shortcuts:

Commonly used:

  • Ctrl L  : clear screen
  • Ctrl M  : equivalent to carriage return
  • Ctrl C  : Interrupt the currently executing program

Historical commands:

  • Ctrl P  : the previous command, you can always press it to turn forward
  • Ctrl N  : next command
  • Ctrl R , then press the string that appeared in the history command: find the history command by string (highly recommended)

Command line editing:

  • Tab : auto-completion (highly recommended)
  • Ctrl A : Move the cursor to the beginning of the command line
  • Ctrl E : Move the cursor to the end of the command line
  • Ctrl B : Cursor back
  • Ctrl F : Cursor forward
  • Alt F : advance the cursor one word
  • Alt B : Cursor back one word
  • Ctrl ] : Search for a string from the current cursor backwards, used to quickly move to the string
  • Ctrl Alt ] : Search the string forward from the current cursor, used to quickly move to the string
  • Ctrl H : Delete the character before the cursor
  • Ctrl D : Delete the character where the current cursor is located
  • Ctrl K : Delete all characters after the cursor
  • Ctrl U : Clear the currently typed command
  • Ctrl W : Delete the word before the cursor (Word, a string without spaces)
  • **Ctrl \ ** : Delete all blank characters before the cursor
  • Ctrl Y : Paste what was deleted by Ctrl W or Ctrl K
  • Alt . : Paste the last parameter of the last command (useful)
  • Alt [0-9] Alt . Paste the parameter [0-9] of the previous command
  • Alt [0-9] Alt . Alt. Paste the parameter [0-9] of the previous command
  • Ctrl X Ctrl E : Bring up the default editor of the system to edit the currently entered command. When exiting the editor, the command will be executed

other:

  • Ctrl Z : Put the current process into the background (you can use the ''fg'' command to return to the foreground later)
  • Shift Insert : paste (equivalent to Windows' Ctrl V)
  • Select and copy in the command line window
  • Press the key in the command line window to paste, you can use Shift Insert instead
  • Ctrl PageUp : screen output page up
  • Ctrl PageDown : screen output page down

Guess you like

Origin blog.csdn.net/ver_mouth__/article/details/126218206