Hot keys in the shell
In this post, you will learn about some keyboard shortcuts that can make life easier for administrators working in the console. All of them work in bash'e. I also tested the keyboard shortcuts on the disk (Cisco IOS Software, s72033_rp Software (s72033_rp-ADVIPSERVICESK9_WAN-M), Version 12.2 (33) SXH4), csh and zsh. Considered in other records I will not repeat myself. The combinations are grouped by the used function key.
Especially useful this text will be people who like to use the Home, End and Delete keys (which "do not work" in the console console).
First a few shortcuts with ctrl.
- Ctrl + a - go to the beginning of the line ( cisco , csh , zsh )
- Ctrl + b - go back one character ( cisco , csh , zsh )
- Ctrl + c - sends the program SIGINT. Usually, it interrupts the current job ( csh , zsh )
- Ctrl + d - deletes the character under the cursor (analogous to delete) ( cisco , csh , zsh )
- Ctrl + e - go to the end of the line ( cisco , csh , zsh )
- Ctrl + f - go to 1 character forward ( cisco , csh , zsh )
- Ctrl + k - deletes everything to the end of the line (EOL, not on the screen!) ( Cisco , csh , zsh )
- Ctrl + l - clears the screen. The analogue of the clear command. ( csh , zsh )
- Ctrl + r - search by history. Repeating the search (scrolling through the search results). That is an incremental search. ( zsh )
- Ctrl + j - stops the search and allows you to edit the found command. If the search was not performed, then the same as pressing return. (in zsh it executes the command)
- Ctrl + t - changes the character under the cursor to the previous one. Or, if you want, pulls the previous character to the end of the line. ( cisco , csh , zsh )
- Ctrl + u - deletes all characters to the left of the cursor to the beginning of the line. ( cisco , in csh , zsh deletes the entire string)
- Ctrl + w - deletes characters to the left of the cursor to the beginning of the word. ( cisco , csh , zsh )
- Ctrl + xx - moves from the current position of the course to the beginning of the line and back. On the cask it works the same way as ctrl + u. ( csh )
- Ctrl + x @ - shows possible additions to the host name (names are taken from / etc / hosts)
- Ctrl + z - suspend the current task ( csh , zsh )
- Ctrl + x; Ctrl + e - opens $ EDITOR to change the entered line. After saving the changes, the team is sent for execution. If a variable is not specified, then a system text editor is opened (for Linux this is often nano)
Now a little about the combinations with the viola.
- Alt + < - go to the first command in the command history ( zsh )
- Alt +> - go to the last command in the history
- Alt +?
- shows a list of possible command additions (similar to tab-tab) (in csh , zsh analogue of which string)
- Alt + * - inserts all possible command additions into the command line
- Alt + / - tries to append filename (same as tab)
- Alt +. - inserts the last argument of the previous command (analog! $, Just do not do: p to check)
- Alt + b - moves the cursor to the left for 1 word ( cisco , csh , zsh )
- Alt + c - makes the letter under the cursor large, and the rest, to the end of the word, small. ( cisco , csh , zsh )
- Alt + d - deletes characters from the current cursor position and to the end of the word. ( cisco , csh , zsh )
- Alt + f - moves the cursor one word forward ( cisco , csh , zsh )
- Alt + l - makes all letters from the current cursor position and to the end of the word small ( cisco , csh , zsh )
- Alt + t - swaps the words under the cursor and the previous one ( zsh )
- Alt + u - translates letters from the current cursor position and up to the end of the word in the upper case ( cisco , csh , zsh )
- Alt + back-space - deletes characters from the current cursor position to the beginning of the word ( cisco , csh , zsh )
In the next paragraph I, for brevity, will write "2T" to indicate double tapping.
- 2T is a command complement. If you click on an empty line, it will list all available commands
- (string) 2T - displays a list of possible additions
- (dir) 2T - will show the subfolders of the folder dir
- * 2T - will show subfolders except hidden (whose names begin with a dot)
- ~ 2T - displays all users from / etc / passwd. After completing the user name, you can go to its home directory. For example ? ~ Oxpa /
- $ 2T - displays a list of additions for system variables
- @ 2T - supplements host names contained in / etc / hosts
- = 2T - listing the current directory, similar to ls.
A small conclusion
Since in my work I mostly use bash and cisco'v shell, I just signed the combinations, which, I know, work for other shells. Csh features , zsh probably is not less than bashev, I just worked with them less.
The above list will incorrectly show without explanation: all these hot keys in bash'e can be reassigned. There are actions that are not assigned to hotkeys by default. Similar "tricks" are described in the bash's manual, which I recommend to read to everyone interested.