Basic knowledge
Detailed explanation of Linux Vim practical commands
Linux common commands
- learned
cd (path switching) rm (followed by -rf to delete files or folders) ls (view files and folders in the current path) mkdir (create a folder) touch (create a file)
cat (view file contents) mv (move files, or rename files) rmdir (delete empty folders) whoami (view current user) pwd (view current path)
- / # Root directory Linux system has no drive letter, only root directory /.
- cd # directory jump
- cp # Copy file cp <file in current folder><destination folder>/ <file name>
# copy folder cp -rf <folder> <destination folder>
- find # find files find /(path) -name '*.py'
find /(path) -size 1024 (+1024 is greater than 1024; -1024 is less than 1024)
sudo find ........ # sudo get permission
Common commands in Vim
cursor positioning;
hjkl move up, down, left and right
0 $ skip to the beginning or end of a line
gg shift+G jump to the beginning or end of the entire file
1G ,2G,3G........NG , skip to the beginning of line 1.2.3 N
/String (n N can be looped) to quickly locate a line,
/^d Quickly locate the line starting with d,
/txt$ Quickly locates lines ending in txt.
Text editing (minor)
y copy. yy 3yy ygg yG (in rows)
d delete dd 3dd dgg dG (in rows)
p paste
x deletes the character under the cursor
D delete from cursor to end of line
u undo undo
^r redo Undo, redo Ctrl + r
r modify a character
enter another mode
a Enter insert mode, insert after the cursor
i enter insert mode, insert before the cursor
o Insert on a new line
A shift + A inserts at the end of the current line
: Enter last line mode (extended command mode)
v enter visual mode
^v Enter visual block mode Ctrl +v
V to enter visual line mode
R enter replace mode to do batch replacements after the cursor, similar to text Insert on Windows
VIm keyword autocompletion in insert mode Ctrl + p / n
Summarize
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!
The above is the detailed content of the Linux Vim practical commands. For more details, please pay attention to other related articles on the html Chinese website!