In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "what are the vi shortcuts in Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Vi operation, it can be said that basically, every key position around the keyboard has its own meaning.
(1) Open vi if you do not enter I, copy-paste characters will result in a few characters missing in front of you.
For example,
> vi test.txt
This is a test file.
At this point, copy the characters "this is a test file". At the beginning of the file, press "shift" and "insert". The file test.txt shows that this is truncated.
S is a test file.this is a test file.
If you enter I and execute "shift" and "insert" again, it will be normal this time, that is, if you need to copy-paste, just to be on the safe side, enter I and then perform the paste operation
This is a test file.this is a test file.
(2) vi editing is completed and there are two exit modes.
To save exit, you can enter ZZ.
Do not save the exit, you can enter ZQ.
In order to improve efficiency, you can use right-hand shift and left-hand Zmax Q in one go.
(3) batch editing
If you need to add the string "sqlplus" to the header of each line of the file, you can execute
:% s / ^ / sqlplus
If you want to change the first a character to b in the following text
This is a test file.this is a test file.
Can be executed
:% s@a@b
If you want to change all a to b, you can execute the
:% s@a@b@g
If you need to count the number of times the a character appears, you can execute
:% s/a//gn
Hint
This is a test file.this is a test file.
2 matches on 1 line
String is also supported. Counting the number of test occurrences can be executed.
:% s/test//gn
Hint
This is a test file.this is a test file.
2 matches on 1 line
(4) find location characters
One line of text, to find out the position of the "a" character
This is a test file.this is a test file.
Can be executed
Fa
Where f represents find,a to represent the character information to be retrieved. Similarly, if you want to find b, you can use fb.
Fb
In addition to characters, characters like "(" also support
F (
This is the end of the content of "what are the vi shortcuts in Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.