In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Vi,Unix&Linux under the most basic editor, powerful and easy to use, is a necessary tool for users.
Mode:
Command mode (default, the contents of the file are edited through commands)
Vi / / create an empty file in the current directory
Vi filename / / Open the specified file
Vi-o | O F1 f2 / / Open multiple files, o | O indicates horizontal | Vertical separation
Automatically enter the command mode after opening the file through vi, where all inputs are commands
Insert mode (used like a normal editor in windows)
Press any key of iaoIAO in command mode to enter insert mode, and esc returns to command mode
I insert text before the cursor
I insert before the line where the cursor is located
An insert text after the cursor
An is not inserted in the line where the cursor is located
O insert a new line under the line of the cursor
O insert a new line on the line where the cursor is located
Edit mode (edit the file or the contents of the file by command)
Press ":" in command mode to enter edit mode, and esc or enter to return to command mode after performing the operation
View mode (belongs to command mode)
VV enters view mode and executes character selection
Example: press "H" or "L" to move the cursor to select characters, copy and cut through yd
Common command
[positioning command]
Hjkl: cursor [left, bottom, top, right] move, same direction key
0: move to the beginning of the line
^: non-blank wardrobe
$: move to the end of the line
Enter: move to the beginning of the downlink
H: move to the top of the screen
M: move to the center of the screen
L: move to the bottom of the screen
Cmurf: next page (Cmurf stands for Ctrl+Shift+F)
Cmurb: previous page
Gg: move to the first line
G: move to the end of the file
[n] G: move to line n of the file
: n move to line n of the file
[delete command]
X: delete characters at the cursor
Nx: n characters after cursor location
X: delete the character before the cursor
Dd: cut the line of the cursor
Ndd: cut the following n lines from the current line
DG: delete the line of the cursor to the end of the file
D: delete the cursor to the end of the line
: N1 penal n2d deletes the content between N1 lines and N2 lines
[copy & paste]
Yy/Y: copying the current line
Nyy,nY: copy the n lines below the current line
Nyh,nyl: copy n characters before / after the cursor
Pforce P: paste lines that have been copied or deleted to the current line or onto the current line
[search & replace]
R: replace the character where the cursor is located
R: replace characters from the cursor to the end by pressing esc
S: replace (delete) the character at the cursor and enter the text input mode
S: replace (delete) the line of the cursor and press esc to end
: / string / / search for strings from top to bottom
:? string / / search the string up from the bottom
Move to the next result by pressing n: ncompass / hour down,? Search for Nmax / h up,? Search downwards in time
:% s/old/new/g / / replacing all old with new,g will not ask, c will ask if no replacement
:% s/old//g / / delete all old
N1mag / / replace the specified string within a certain range
Example: continuous line comments
: N1 ~ ~ n2s / ^ / # / g / / ^ indicates the beginning of the line
: n1Jing n2s / ^ / # / g / / replace the beginning of the line'# 'with an empty one, that is, delete
: N1 Jing n2s / ^ / g / / escape character, use "/ /" to comment
Replace: enter or space when ab asmmail samlee@lampbrother.net// enters a, and vi will automatically change to b
Unab// cancel
[undo]
U: undo the previous action (up to when the file is open).
U: undo all actions on the current row.
Ctrl+r: undo
[save exit]
W save
W newfilename save as
: w! Force save /! For file owners and administrators only
Wq save & exit / / shortcut key ZZ
Q exit
: q! Forced exit
: wq! Force save & exit
: X save exit
: x! Force save & exit
[other]
: set nu/number / / set line number
: set nonu / / cancel the line number
: set ic / / case-sensitive
: set noic / / cancels case sensitivity
: vsp / / Vertical window
: sp / / horizontal window
CmurW penclosed / / switch to the previous / next window
R filename imports the contents of the specified file (cursor location).
:! Cmd runs the cmd command
R! date imports command results into a file
Map shortcut key trigger command
Map ^ P I # / / comment this line using ctrl+p (enter "^ [P]" using ctrl+v+ [p])
Map ^ B 0x / / Uncomment
Unmap
Vi configuration:
Set the vi default environment through the vi configuration file.
Example: set vi to display line number by default
Cd ~ / / return to the current account home directory
Vi .vimrc / / vi configuration file, which does not exist by default, in the home directory, for the current user
ICompact / enter edit mode
Set nu
Map ^ P I#
……
: wq
I realized the above on the linux based on sail-imx6q (Electric Fish Electronics) development board, and my friends can also check it out on this development board.
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.