In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what are the skills for using VI commands in Linux", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn "what are the skills for using VI commands in Linux".
Enter the vi command
Vi filename: open or create a new file and place the cursor at the beginning of the * line
Vi + n filename: open the file and place the cursor at the beginning of line n
Vi + filename: open the file and place the cursor at the beginning of the * line
Vi + / pattern filename: open the file and place the cursor at * strings that match pattern
Vi-r filename: system crash occurred the last time you were editing with vi. Restore filename vi filename....filename: open multiple files and edit them in turn
Move cursor class command
H: move the cursor one character to the left
L: move the cursor one character to the right
Space: move the cursor one character to the right
Backspace: move the cursor one character to the left
K or Ctrl+p: move the cursor up one line
J or Ctrl+n: move the cursor down one line
Enter: move the cursor down one line
W or W: move the cursor right one word to the prefix
B or B: move the cursor left one word to the prefix
E or E: move the cursor right one word j to the suffix
): move the cursor to the end of the sentence
(: move the cursor to the beginning of the sentence
}: move the cursor to the beginning of the paragraph
{: move the cursor to the end of the paragraph
NG: move the cursor to the beginning of line n
Nmarker: move the cursor down n lines
Nmury: move the cursor up n lines
Cursor: move the cursor to the end of the nth line
H: move the cursor to the top line of the screen
M: move the cursor to the middle line of the screen
L: move the cursor to the screen * line
0: (note the number zero) move the cursor to the beginning of the current line
$: move the cursor to the end of the current line
Mobile cursor class command
Ctrl+u: turn half the screen to the first part of the file
Ctrl+d: flip half the screen to the end of the file
Ctrl+f: flip a screen to the end of the file
Ctrl+b; flipped through the first screen of the file.
Nz: scroll the nth line to the top of the screen, or the current line to the top of the screen if n is not specified.
Insert text class command
I: in front of the cursor
I: at the beginning of the current line
A: after the cursor
A: at the end of the current line
O: create a new line under the current line
O: open a new line above the current line
R: replace the current character
R: replace the current character and subsequent characters until you press the ESC key
S: replaces the specified number of characters with the entered text, starting at the current cursor position
S: delete the specified number of lines and replace them with the entered text
Ncw or nCW: modifies a specified number of words
NCC: modifies a specified number of rows
Delete command
Ndw or ndW: delete the word NMY at the beginning and after the cursor
Do: delete to the beginning of the line
Delete: delete to the end of the line
Ndd: delete the current line and the subsequent nmur1 line
X or X: delete a character, x after the cursor, and X before the cursor
Ctrl+u: deletes text entered in input mode
Search and replace commands:
/ pattern: search the end of the file from the beginning of the cursor pattern? pattern: search the head of the file from the beginning of the cursor pattern n: repeat the previous search command in the same direction
N: repeat the last search command in the opposite direction
: s/p1/p2/g: replace all p1 with p2 in the current line
: N1 Magazine, n2sqqp1, p2Unix, g: replace all p1 with p2 in lines N1 to N2.
: g/p1/s//p2/g: replace all p1 in the file with p2
Option settin
All: lists all option settings
Term: setting terminal type
Ignorance: ignore case in search
List: displays the tab stop (Ctrl+I) and the line end flag ($) number: displays the line number
Report: displays the number of modifications made by line-oriented commands
Terse: displays a short warning message
Warn: displays NO write information if the current file is not saved when transferring to another file
Nomagic: allows special characters not preceded by "\" to be used in search mode
Nowrapscan: forbids vi to start from the other end when the search reaches both ends of the file
Mesg: allows vi to display information written to their terminals by other users using write
* Line command
: N1 co N2 n3: copy the content between lines N1 and N2 under line n3
: N1 meme N2 m n3: move the content between lines N1 and N2 to the next line n3
: N1 and N2 d: delete the content between N1 lines and N2 lines
W: save the current file
: e filename: open the file filename for editing
X: save the current file and exit
: Q: exit vi: Q quit: do not save the file and exit vi:! command: execute the shell command command: N1 ~ N2 wicked command: take the contents of lines N1 through N2 in the file as input to command and execute it, if not specified
If N1 is specified, N2 means that the entire file content is used as the input of command.
: ringing command: puts the output of the command command to the current line.
These are all the contents of this article entitled "what are the skills for using VI commands in Linux?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.