Recently, I found that many colleagues, especially our PHP developers, basically do not use shortcuts in Linux/unix, which seriously affects work efficiency, after each usage, I will describe it in detail. All of the following commands are valid in Linux/unix shell. bash is the main command here. In case of any discrepancy
Recently, I found that many colleagues, especially our PHP developers, basically do not use shortcuts in Linux/unix, which seriously affects work efficiency, after each usage, I will describe it in detail.
All of the following commands are valid in Linux/unix shell. bash is the main command here. In case of any discrepancy, your own server shall prevail. Linux mentioned in this article mainly refers to RHEL/CentOS, and unix refers to FreeBSD, which is also the most used version on the server.
Ctrl + a switch to the command line
This operation has the same result as Home, but Home cannot be used in some unix environments, so this combination can be used. vim in Linux is also effective. In addition, this is also effective in many file editors in windows.
Ctrl + e switch to the end of the command line
The result of this operation is the same as that of END, but the End key cannot be used in some unix environments. vim in Linux is also valid. In addition, this is also effective in many file editors in windows.
Ctrl + l clear screen content, equivalent to clear
Ctrl + u clear the content before cutting the cursor
This command is useful in nslookup. I sometimes see my colleague deleting shell commands with one word at a time, which is very bad! In fact, it can be done with a Ctrl + u.
Ctrl + k cut the content after clearing the cursor
Ctrl + y paste the deleted character
This command is powerful. the characters to be deleted may be strings, but it is very likely to be a line of command.
Ctrl + r search in the History Command (this is very useful, and the previous command will be called out after the keyword is entered)
I strongly recommend this command. sometimes there are too many history commands to find a complicated one. here, shell will automatically find and call the command, which is very convenient.
Ctrl + c terminate command
Ctrl + d exit shell, logout
Ctrl + z transferred to the background for running
However, the process transferred from Ctrl + z to the backend will be terminated after the current user exits. Therefore, it is better to use the nohup Command &, the role of the nohup command is that the process continues to run after the user exits, and many scripts and commands require that the process remain valid when the root user exits.
I am not familiar with the following operations:
!! Repeat the last command
History displays the numbers and history commands you have executed. This can be used together! Edit to execute xx command
← (Ctrl + p) display the previous command
Hide (Ctrl + n) display the next command
! $ Display the latest system parameter
Finally this is useful, for example, I first use cat/etc/sysconfig/network-scripts/ifconfig-eth0, and then I want to edit it with vim. In general, first use the terminal command to display the last command, then use Home to move to the beginning of the command, delete cat, and then enter the vim command. In fact, we can use vim! $.
After the development and administrator master the above usage, the work will be very efficient. at the end of the use, you will inadvertently find that you can easily handle a lot of complicated commands between fingers.