This page has been robot translated, sorry for typos if any. Original content here.

Shell hotkeys

Shell hotkeys

Brief introduction

In this post you will learn about some shortcuts that can simplify the life of administrators working in the console. All of them work in bash'e. I additionally tested the keyboard shortcuts on a tsiska (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 too much. Combinations are grouped by used function key.

This text is especially useful for people who like to use the Home, End and Delete keys (which “do not work” in the tsiskovoy console).

Combinations

First, a few shortcuts with ctrl.

  • Ctrl + a - go to the beginning of the line ( cisco , csh , zsh )
  • Ctrl + b - move back one character ( cisco , csh , zsh )
  • Ctrl + c - sends the program SIGINT. Normally, interrupts the current job ( csh , zsh )
  • Ctrl + d - deletes the character under the cursor (analogous to delete) ( cisco , csh , zsh )
  • Ctrl + e - jump to the end of the line ( cisco , csh , zsh )
  • Ctrl + f - move forward 1 character ( 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. Repeat the search (paging search results). That is an incremental search. ( zsh )
  • Ctrl + j - terminates the search and allows editing the found command. If the search is not performed, then the same as clicking return. (in zsh 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 line)
  • Ctrl + w - deletes characters to the left of the cursor to the beginning of a word. ( cisco , csh , zsh )
  • Ctrl + xx - moves from the current course position to the beginning of the line and back. On a tsiska works similarly to 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 string. After saving the changes, the command is sent for execution. If the variable is not set, then the system text editor opens (for Linux, this is often nano)

Now a little about combinations with viola.

  • Alt + < - go to the first command in command history ( zsh )
  • Alt +> - go to the last command in the history
  • Alt +? - shows a list of possible additions to the command (similar to tab-tab) (in csh , zsh is the analogue of which string)
  • Alt + * - inserts all possible command additions to the command line
  • Alt + / - tries to add a file name (similar to tab)
  • Alt +. - inserts the last argument of the previous command (analog! $, Just don’t do: p to check)
  • Alt + b - moves the cursor left by 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 to the end of the word. ( cisco , csh , zsh )
  • Alt + f - moves the cursor one word forward ( cisco , csh , zsh )
  • Alt + l - makes all the letters from the current cursor position 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 the letters from the current cursor position to the end of the word in upper case ( cisco , csh , zsh )
  • Alt + back-space - deletes characters from the current cursor position to the beginning of a word ( cisco , csh , zsh )

In the next paragraph, for brevity, I will write “2T” to denote double-click tabs.

  • 2T - addition team. If you click with an empty line - displays a list of all available commands.
  • (string) 2T - will list the possible additions
  • (dir) 2T - will show the dir folder subfolders
  • * 2T - will show the subfolders except the hidden ones (the names of which begin with a dot)
  • ~ 2T - displays all users from / etc / passwd. By adding the username you can go to his home directory. For example ? ~ Oxpa /
  • $ 2T - lists additions for system variables
  • @ 2T - complements hostnames contained in / etc / hosts
  • = 2T - listing of the current directory, similar to ls.

Small conclusion

Since I most often use bash and cisco shell in my work, I simply signed combinations that I know work for other shells. Csh features , zsh is certainly not less than Bashy, I just worked less with them.

The above list will not be shown correctly without explanation: all these shortcuts in bash can be reassigned. There are actions that are not assigned to hotkeys by default. Such "tricks" are described in the bash manual, which I recommend reading to anyone interested.