In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "vi and vim commands in Linux". In daily operation, I believe many people have doubts about vi and vim commands in Linux. I have consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "vi and vim commands in Linux". Next, please follow the editor to study!
1. General mode: delete, copy and paste class command XMagol X x deletes one character backward, X deletes a character nx (n represents a number), deletes n characters backward, dd deletes the current line D deletes all characters on the current line Try to be a blank line ndd (n stands for numbers) delete the line of the cursor down n column d1G delete all data from the row of the cursor to the first row dG delete all data of the row from the cursor to the last row yy copy the row of the cursor Y1G All data from the line of the cursor to the first row yG copy all data from the row of the cursor to the last line ynj (n represents numbers) copy the line of the cursor downward 1 line dnj (n represents numbers) delete the line of the cursor down line 1 line p P p paste the copied data on the next line of the cursor P paste the copied data on the previous line of the cursor J combines the row of the cursor with the data of the next row into a line u to restore the previous action (undo) 2. The edit mode command iMagery I inserts the entered text at the current cursor location I insert the input text for the first non-empty character on the line of the cursor A Magi An inserts the input text for the next character at the current cursor, and An inserts the input text at the next character of the last character of the cursor line for the beginning of the next line. O begins to insert the character RMagol R r at the beginning of the previous line of the line where the cursor is located, R is the character that replaces the cursor, and R continues to replace the text indicated by the cursor until you exit Esc Return to the general mode. 3. Command mode h cursor moves one character to the left j cursor moves down one character k cursor moves up one character l cursor moves one character to the right Ctrl+f screen turns down one page Ctrl+b screen Turn the curtain up one page Ctrl+d screen turn down half page Ctrl+u screen turn half page up + the cursor moves to the first non-empty character of the next line-the cursor moves to the first non-empty character of the current line n spaces (n represents a number) cursor toward the current line Move n characters 0 (number 0) to the right the cursor moves to the first character of the current line (can be a null character Note that the $cursor moves to the last character of the current line (can be an empty character) Note that the H cursor moves to the first non-empty character M of the top line of the current screen, the first non-empty character L cursor of the middle line of the current screen, and the first non-empty character G of the bottom line of the current screen. The cursor moves to the first non-empty character on the last line of the article nG (n represents a number) the cursor moves to the first non-empty character on the nth line of the article, the n cursor moves down the current line, the first non-empty character / word looks for the word string after the cursor? word Find the word string before the cursor: s/word1/word2/g looks for word1 on the current line of the cursor And replace it with word2:n1,n2s/word1/word2/g to find word1 between lines N1 and N2, and replace it with word2:%s/word1/word2/g to find word1 throughout the article. And replace it with word2:w to save the edited data to a hard disk file: W [filename] saves the edited data to another file on the hard disk: r [filename] reads the data in another file when editing the data. Add the contents of the filename file to the next line of the cursor: wq or: X Save and exit: Q exit, applicable to unmodified files: Q! Forced exit, applicable to modify the file without saving exit: set nu display line number: set nonu cancellation line number: N1 department N2 w [filename] to save the contents of the N1 to N2 lines to the file named filename, on the "Linux in the vi and vim commands Daquan" on the end of the study, I hope to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.