Ctrl + A: Moves to the beginning of the currently edited command,
Ctrl + E: Moves to the end of the currently edited command line,
Ctrl + F or->: move by word aligns (toward the end of the command line, forward)
Ctrl + B or <-: Moves left by character (toward the end of the command line, and then backwards)
Alt + F: Move right by word (toward end of command line, forward)
Alt + B: Moves left by word (toward the beginning of the command, then back)
Edit:
Ctrl + C: Delete entire row
Ctrl + L: Clear screen, equivalent to clear
Ctrl + U: Introduction to the content of the cursor position to the beginning of the line (including itself), later can be ctrl+y pasted
CTRL + K: Cuts the cursor position to the end of the line (including itself) and can be pasted later with Ctrl + Y
CTRL + W: Cut from the cursor position to the starting position of the current word, and you can paste it later with Ctrl + Y
Alt + D: Cut from the position of the cursor to the end of the current word, you can later paste with Ctrl + Y
Ctrl + Y: After pasting into the cursor
Historical command-Related:
- !! : Executes the previous command, so the quick sudo method is sudo!!
- !blah: Executes the most recent command starting with Blah, such as!ls
- !blah:p: Print output only, without performing
- !$: The last parameter of the previous command, with Alt +. Same
- !$:p: Print out the contents of the!$
- !*: All parameters of the previous command
- !*:p: Print out the contents of the!*
- ^blah: Delete blah from previous command
- ^blah^foo: Replace blah in the previous command with Foo
- ^blah^foo^: Replace all blah in the previous command with Foo
Ctrl+p: Previous command (UP ARROW)
CTRL + N: Next command (down arrow)
Historical Command Search:
Ctrl+r: Enter a number of characters (keywords) that will search for historical commands that contain the keywords you have entered. Continuing to press Ctrl+r will continue to search for historical commands that contain keywords. Once the target command is found, you can press ENTER directly to execute the found command. If you still want to modify the parameters, you can press the right arrow.
Ctrl+g: Jump out of Ctrl+r's search mode
"Linux use" Bash Shell command line common shortcut keys (reprint)