Linux command line editing shortcuts

Summarize some of the most useful

ctrl + ? Undo the previous input
ctrl + c Start a new line
ctrl + r Enter the word search history command
ctrl + u Delete all characters before the cursor is equivalent to d shift + ^
ctrl + k delete the cursor in VIM All the following characters are equivalent to d in VIM shift+$


ctrl + d Delete the character at the cursor position is equivalent to x or dl
ctrl + y in VIM Restore the characters deleted when ctrl+u was executed last time
ctrl + ? Undo the previous input
alt + r Undo the previous action

ctrl + a Move the cursor to the beginning of the command line is equivalent to shift+^
ctrl + e in VIM Move the cursor to the end of the command line is equivalent to shift+$ in VIM


Delete
ctrl + d Delete the character at the cursor position is equivalent In VIM x or dl
ctrl + h delete the character before the cursor position is equivalent to hx or dh
ctrl + k delete all characters after the cursor is equivalent to VIM d shift+$
ctrl + u delete all characters before the cursor is equivalent to VIM d shift+^
ctrl + w delete the word before the cursor is equivalent to db in VIM
ctrl + y restore the character deleted when ctrl+u was executed last time
ctrl + ? undo the previous input
alt + r undo the previous action
alt + d delete the cursor position after word

Move
ctrl + a Move the cursor to the beginning of the command line is equivalent to shift+^
ctrl + e in VIM Move the cursor to the end of the command line is equivalent to shift+$
ctrl + f in VIM Move the cursor back one character is equivalent to l
ctrl + in VIM b The cursor moves forward one character is equivalent to h in VIM
ctrl + arrow key left cursor moves to the beginning of the previous word
ctrl + arrow key right cursor moves to the end of the next word
ctrl + x in the character where the cursor was last and where the current cursor is Jump between characters
alt + f Jump to the end of the word at the cursor position

Replace
ctrl + t Replace the current character of the cursor with the previous character
alt + t Swap the current position of the two cursors and the word before
the cursor alt + u Put the cursor Change the word at the current position to uppercase
alt + l Change the word at the current position of the cursor to lowercase
alt + c Change the first letter of the word at the current position of the cursor to uppercase
^oldstr^newstr Replace the string in the previous command

History command editing
ctrl + p Return to previous Enter a command character once
ctrl + r Enter a word search history command
alt + p Enter a character to find a historical command similar to the character
alt + > Return to the last executed command

Other
ctrl + s Lock the terminal
ctrl + q Unlock the terminal
ctrl + l Clear the screen is equivalent to the command clear
ctrl + c Start a new line
ctrl + i Similar to the TAB completion function
ctrl + o Repeat the number of times the command
alt + number key operations are executed

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326865357&siteId=291194637