Creating Keyboard Shortcuts
Learn how to create keyboard shortcuts in a Bash environment.
We'll cover the following...
List of defined commands
Several keyboard shortcuts are at our disposal. We learned about several of them in Useful Shortcuts. For example, we learned that “Ctrl+l” clears the screen and “Ctrl+a” jumps to the beginning of the line. We can use the bind -p
command to see a list of all the defined commands available. It’s a long list, so let’s use less
:
$ bind -p | less
Use the terminal below to practice this command.
Making our own commands
In addition to the commands already defined, we can make our own. Let’s try it out by using the bind
command to map “Ctrl+t” to execute the pwd
command:
$ bind '"\C-t": "pwd\n"'
After this command is executed, we press “Ctrl+t”.
Use the ... ...