We all know that most Linux system operations need to be completed using commands, but the commands are more complicated to operate, and it is much simpler to set common commands as keyboard shortcuts. The following small series will introduce you to the method of setting the Linux command as a keyboard shortcut. Let's take a look at the interested friends.
can be any combination of commands or command assigned to a key on the keyboard, may be Alt + [AZ],
Ctrl- [AZ], Alt + Shift + [AZ ], F1-F12, Ctrl-F[1-12], Alt-F[1-12], Alt+Shift+F[1-12], and even more incredible is that even the function key can be added to &ldquo ; parameter & rdquo;, so that when you press the key, it will wait for you to enter the corresponding parameters, and run different commands according to different parameters.
Of course, there are some hotkeys that will be captured by the terminal, such as the common Ctrl-D/C/Q/Z, but it doesn't matter, there are more hotkeys available!
The configuration file for defining the hotkey is: /etc/inputrc or ~/.inputrc. The format of the hotkey is defined as follows:
“ "ASCII characters corresponding to hotkeys" ”: & ldquo; "execution of the order" & rdquo;
The ASCII characters corresponding to the hotkey can be entered by "Ctrl-V, then press the hotkey", such as the character corresponding to Ctrl-G For ^G, the character corresponding to Alt-P is ^[p, the character corresponding to Ctrl-Alt-H is ^[^H.
You can use /C instead of Ctrl, /M instead of Alt, /M-/C instead of Alt-Ctrl, such as /CM = Ctrl-M, /M-/CH = Alt-Ctrl-M. You can also use /e for ^[.
Let's look at some basic hotkey definitions (here the letters in the hotkeys are not case sensitive):
“^[-”:“su -/C- M” # Press Alt+- to execute the su - command. The end /CM indicates that you can enter the defined command and press Enter. You can also use a /n to indicate it more succinctly.
“/M-/C-G”:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& -g opens gaim in the current shell and runs independently from the shell, ie gaim won't close even if you quit the shell
Other combinations can be configured according to your needs, even less said.
You may feel that the definition of hotkeys is too messy, and it is difficult to remember, there are certain restrictions. This problem will be solved later.
Under normal circumstances, we can use the up and down direction keys to find the command history list, so as to repeat the input command, but the direction key is too far from the main keyboard area, such as "frequently used, it will delay a lot of time." And it is not very convenient when moving the right hand. Is there any way to transfer the function of the arrow keys to the place where we often click the command? If you use Alt+J = Down Arrow to find it down, Alt+K=Up Arrow looks down
This can be done by defining a hotkey:
“/eh”:&ldquo ;^[OD” # move left
# Alt-H Moves one character to the left, which is equivalent to Left Arrowgh, where ^[OD is the ASCII character of the up arrow, and the input method is similar to the one mentioned earlier. Br>
“/el”:“^[OC” # move right
# Alt-L Move one character to the right, equivalent to Right Arrow
“/ej&rdquo ;:“^[OB” # move up
# Alt-J Move down, equivalent to Up Arrow
“/ek”:“^[OA” # move down
# Alt-K Move up, equivalent to Down Arrow
“/ei”:“^? <# left earse one character
# Alt-I Delete a character to the left, equivalent to Backspace
“/eo”:delete-char # right earse one character
# Alt-O Delete a character to the right, equivalent to Delete
“/en”:backward-kill-word # left kill one word
# Alt-N Delete to the left One word
“/em”:kill-word # right kill one word
# Alt-M Delete a word to the right
“/ea”:&ldquo ;^[n^[n^[n^[n^[n^[n^[n” # kill to the head
# Alt-A Delete the current position to the beginning, that is, more Alt-N Several times (A--" ahead)
“/ee”:“^[m^[m^[m^[m^[m^[m^[m” # kill to the head
# Alt-E Delete the current position to the end, that is, multiple Alt-M times (E--" end)
“/ep”: insert-last-argumem“< Br>
# Alt-P Insert the last parameter of the previous command (P--" Paste)
”/ew“: forward-word
# The system defaults Alt-F (forward) to jump to the end of the current word, if it is already at the end of the word, skip to the next word (one word on the right) Suffix
”/eq“: backward-word
# System default Alt-B (backward) jumps to the beginning of the current word, if it is already at the beginning of the word, skip to the previous word (one word on the left) prefix
Previous12Next page Total 2 pages
In order to more convenient Internet access, we usually let our computer bind the network card. Howe
There are many ways to produce a MAC address under Linux. In addition to the common shell generation
Before the small series introduced the svn command to everyone, can not read the Linux SVN tool comm
Under Linux, you need to implement file transfer between two servers. You can use t
How Linux uses ssh to transfer files to FTP space
Linux system management disk and file method
How Linux uses Crontab to schedule daily work
The principle of implementing breakpoint resume in Linux
Linux tips for using FDisk tools
How Linux limits user login failures through PAM
Summary of zypper command usage in SUSE Linux system
Linux using the example of the watch command
How can I handle the fdisk command in RedHat system without using all partitions?
Linux uses the blockdev command to adjust the file read-ahead size
Microsoft confirms restrictions on Linux
How to optimize virtual memory win10? Win10 virtual memory setting skills
The linux shell implements four arithmetic operations (integer and floating point). Simple method
Win10 system keyboard case switch button (Caps Lock) failure analysis and solution
Windows 7 quickly solves network problems through local connections.
How to adjust the volume of different applications in Windows 8 system
How to set up 3D text screen saver in Win10?
How Win8 Adds Music to a Music App