In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "Linux skills and Vim command comparison", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the skills of Linux and the comparison of Vim commands".
(1): execute the command under the Linux command line, moving the cursor to the beginning of the line (an is the abbreviation of ahead)
Moving the cursor quickly is not only a high-priority requirement under Vim, but also a common work scenario under the Linux command line.
For example, after typing a long list of commands under the Linux command line, if you want to execute a command first, press the key combination to move the cursor to the beginning of the line and enter the command you want to add.
There are also useful commands for quickly moving the cursor to the beginning of a line under Vim. In normal Vim mode, use 0 to move the cursor to the beginning of the current cursor line, and ^ to move the cursor to the first non-empty character of the current line under Vim.
(2): execute the command under the Linux command line, moving the cursor to the end of the line (e is the abbreviation of end)
Since there is a need to quickly move the cursor to the beginning of the line, there is also a need to quickly move the cursor to the end of the line. The command corresponding to the combined key moves the cursor to the end of the line so that you can continue entering the command you want to execute.
There is also a command under Vim to quickly move the cursor to the end of the line. In normal Vim mode, use $to move the cursor to the end of the current line, and the A command to move the cursor to the end of the current line and enter insert mode.
(3): when you execute the command under the Linux command line, you will enter the history command search window. Enter the command you want to find to quickly select the history command.
Personally, the (r is an abbreviation for retrieve) command is a very practical Linux technique. When you need to find a command in a history command that has been executed (that is, the result of the history command) and execute it again, you can use the search window that brings up the Linux history command and enter the current command you want to find to find and re-execute it.
Of course, you can find a command named xxx in the list of executed historical commands through history | grep xxx, and then copy the command and repeat it.
There is no doubt that the above steps are more efficient and convenient.
The fuzzy search plug-in ctrlp in Vim is very similar to the function performed on the command line of the Linux terminal. Ctrlp is recommended as a must-have Vim plugin for you.
(4): executing the command under the Linux command line deletes a word near the current cursor (a string separated by spaces)
Delete a word near the current cursor, which is a scene you often encounter at work. When entering a command on the command line, it often needs to be deleted because of typing mistakes or changing the command. The efficiency of using the backspace key (Backspace) to delete characters one by one is too low. If you can delete one word at a time, it will greatly reduce the number of keystrokes and improve the overall efficiency of Linux use.
W represents a string separated by a space, which is the same concept under Vim. Recommended reading: Vim is based on word movement and Vim word and string concepts.
(5): executing the command under the Linux command line will delete all the text that has been typed out on the command line (that is, delete the whole line)
It is often necessary to cancel a long list of orders that have been typed out at work. In addition to interrupting the command that is about to be executed in advance, you can also use to delete all characters that have been entered on the command line.
Personally, I think it is not very practical, after all, there are already combined commands to complete the same operation, which is well known by everyone.
Note: it is used to interrupt the execution of the program and to suspend the execution of the program (which can be resumed by the fg command).
Under Vim, you can use the dd command to quickly delete the line of the current cursor.
(6): execute the command under the Linux command line to delete the text of the paste, etc. Command.
When you delete some characters that have already been typed on the Linux command line, you can paste them out again at the appropriate time so that you can use them again.
Anyone familiar with the basic Vim commands knows that y is an acronym for yank in the Vim command set, meaning paste function. Under Vim, you often use the yy command to paste the copied text.
If you are so smart, you must remember the yy command, and naturally you will also remember the command. (that's why you compare these Linux practical skills with the Vim command in this article.)
(7)! xx keyword: when this command is executed under the Linux command line, the most recent history command containing the xx keyword is executed
The history command records a list of recent historical commands executed by the Linux system. If you need to repeat the last command that contains the xx keyword, you can use the! xx keyword.
! Really use an operating artifact under Linux. You can use it to quickly execute a history command, avoiding repetitive keystrokes and reducing the amount of work needed to find history commands through the human flesh of the "↑" arrow.
If there are multiple historical commands containing the xx keyword, and the target command you want to execute this time is not the closest one from the current time, you can also use it! The method of line number n specifies the execution of the command with line number n in the history list.
As you can see,! You can specify the history command to be executed either by keyword or precisely by line number. It is recommended to use the search engine search keyword "linux exclamation point" to read more details about the content.
There seems to be no command with similar function under Vim?
(8) execute this command under the cd -: Linux command line, which will change the current directory to the last directory.
When operating under the Linux command line, we often encounter the situation that after painstakingly entering a deep directory and performing some operations, we accidentally enter the cd command to switch back to the current user root directory. Entering the full deep directory again or entering it again by flipping through the "↑" key is obviously a "stupid" way.
Under Linux, assuming that the current directory is a, you can quickly switch back to the a directory by using the cd-command after switching to the b directory with a path command in cd.
(9): execute this command under the Linux command line to paste the contents copied to the system clipboard
Under the Linux command line, in addition to pasting copied text with the right mouse button, you can also use key combinations to complete the paste operation.
It is said that geek Linux players can do all their daily tasks without using a mouse. Pasting text can obviously reduce the frequency of using the mouse. Is it a more efficient and convenient way to paste text when using remote terminal emulation software such as xshell?
Note: used to copy the selected command line console text (not oh).
(10): execute this command under the Linux command line to clear the current screen
Under Linux, you can use the clear command to clear the entire screen to achieve the same effect.
Under Vim, the zz command can be used to redraw the screen and display the current line in the middle of the window.
At this point, I believe you have a deeper understanding of "Linux skills and Vim command comparison". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.