5 sets of shell tips that you can use every day, but you may not know


1. Move the cursor

Ctrl + A Ctrl + EMove the cursor to the front / back
Ctrl + H Ctrl + DDelete a word character before / after
Ctrl + B Ctrl + FCursor forward / backward one character
Esc + B Esc + FCursor forward / next word

2. kill and yank

Ctrl + KCut out all characters after the cursor
Ctrl + UCut all characters before the cursor
Ctrl + WDelete the word before the cursor
Ctrl + YPaste

3. Ctrl + X + E: one time script

Press on the command lineCtrl + X + EThe one-time script will be opened and edited:q(VI) if you leave, you will find that the script just appeared on the command line. This function can easily write multi line instructions such as loop back

4. Ctrl + RLook forward to history

In addition to using things likehistory | grepIn addition to the search history command, you can actually pressCtrl + RAnd directly input relevant instructions to search

5. !!: last instruction

If you need to add another instruction before the previous instruction, for examplesudo, which can be usedCtrl + U+sudo +Ctrl + YTo achieve
But the quick way is to inputsudo !!.