Shell Command Line Shortcuts

Search
Ctrl+r: Quickly search history commands. (r: retrieve)
Ctrl+p: The last used history command. (p: previous)
Ctrl+n: History command used next. (n: next)

Move
Ctrl+a: cursor back to the beginning of the command line. (a: ahead)
Ctrl+e: The cursor returns to the end of the command line. (e: end)
Ctrl+b: Move the cursor one character to the beginning of the line. (b: backwards)
Ctrl+f: Move the cursor one character to the end of the line. (f: forwards)
Alt +f: Move the cursor forward one word. (f: forwards)
Alt +b: Move the cursor back one word. (b: backwards)

Delete
Ctrl+w: Delete the word before the cursor. (Excluding the character at the cursor)
Alt +d: Delete the word after the cursor. (including the character at the cursor)
Ctrl+k: Delete the character from the cursor to the end of the line. (including the character at the cursor)
Ctrl+u: Delete the character from the cursor to the beginning of the line. (Excluding the character at the cursor)
Ctrl+h: Delete one character to the beginning of the line.
Ctrl+d: Delete one character to the end of the line.

Paste
Ctrl+y: Paste what was just deleted.

Other control keys
Tab key: command, file name and other auto-completion functions.

Ctrl+t: Swap the character under the cursor with the character before it.

Ctrl+i: Equivalent to the Tab key.
Ctrl+m: Equivalent to the Enter key.
Ctrl+o: Equivalent to Ctrl+m.

Ctrl+v: Insert special characters. For example: Ctrl+v+m (insert ^M)

Ctrl+s: Suspend the current shell. The terminal screen of fast output can be stopped.
Ctrl+q: Exit Ctrl+s state.
Ctrl+z: Make the task running in the terminal run in the background. (Resume with fg)
Ctrl+c: Interrupt the task being executed in the terminal.
Ctrl+d: Exit the terminal.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326066671&siteId=291194637