The following list shows the readline shortcuts I find most useful. There are more of these available but many deal with situations I don't find useful very often so they're not worth memorizing for me. If you're interested, you can easily find the rest by typing "Unix readline shortcuts" into Google. In the following list, the "Ctrl-a" means to hold the control key down while also typing the "a" key.
- Ctrl-a – go to the start of the command line
- Ctrl-e – go to the end of the command line
- Ctrl-k – delete from cursor to the end of the command line
- Ctrl-u – delete from cursor to the start of the command line
- Ctrl-l – clear the screen
- Alt-b – move backward on the command line by one word
- Alt-f – move forward on the command line by one word
Now we can combine this readline editing with the Bash command history. You can use the up arrow to recall previously issued commands and then use these handy readline shortcuts to edit one of the commands and issue the modified command. Sometimes that can make for a significant time savings.
No comments:
Post a Comment