The less command to view the file :
less xxxxx
parameter:
b turn back one page
d turn back half a page
h Display the help interface
Q to quit the less command
u Scroll forward half a page
y scroll forward one line
Spacebar to scroll a line
Enter key to scroll one page
[pagedown]: Scroll down one page
[pageup]: Scroll up one page
G - move to the last line
g - move to the first line
Both more and less have the search function, press / and then enter the string to be found, then press Enter, and press n (next) to continue searching,
Uppercase N is to look back (up), press q (quit) or ZZ to leave
Or (in command mode, press '/' or '?', then type the character you want to find, Enter.
The difference between / and ? is that one looks forward (down) and the other backward (up). )
not case sensitive
Default is case sensitive
Enter first
:set ignorecase //ignore case
to find
re-enter
:set noignorecase //restore to case sensitivity
-----------------------------------------------------------------------------------------------
vi Find and replace:
Search is the same as more and less.
replace:
:s/vivian/sky/ Replace the first vivian of the current line with sky
:s/vivian/sky/g replace all vivian in the current line with sky