Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Edit vi Shortcut key in liunx

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Operating system shortcut

1) use the arrow keys ↑ ↓-quickly access history commands (all input commands will be temporarily saved in memory-> saved in disk files)

2) move the cursor quickly

Ctrl + a-quickly move the cursor to the beginning of the line

Ctrl + e-quickly move the cursor to the end of the line

Ctrl + ← →-move the cursor quickly from side to side according to the word

3) Quick operation command information

Ctrl + u-cut the contents in front of the cursor

Ctrl + k-cut the content behind the cursor

Ctrl + w-cut each string information with spaces as delimits

Ctrl + y-paste the cut

4) Special feature shortcuts

Ctrl + c (cancel)-interrupt or cancel the command execution process

Ctrl + l (clear)-clear screen operation

Ctrl + s-enter the locked state

Ctrl + Q-exit locked state

Edit command using method vi/vim

1) Edit command mode information

Command mode: can realize special function operation

Edit mode: you can edit file content information

Bottom line mode: you can enter special command information wq q wq! Q!

Command mode-I-> edit mode-esc- > command mode

Command mode -:-> bottom line mode-esc- > command mode

2) Command mode-> edit mode

I-enter edit mode directly at the cursor position

I-switch the cursor to the beginning of the line to enter edit mode

A-enter edit mode with one character below the cursor

A-switch the cursor to the end of the line and enter edit mode

O-insert a new line below the line of the cursor and enter the editing state

O-insert a new line above the line of the cursor and enter the editing state

S-delete the character where the cursor is located and enter the editing state

S-delete the line of the cursor and enter the editing state

3) Command mode-> bottom line mode

:-enter the bottom line mode and complete the functional operation wq! Q!

/-search for file information n look down N look up

?-search file information n look up N look down

PS: ignore case to find data in files

/ oldboy\ c

4) how to move the cursor quickly (command mode)

G-switch to the last line of the file

Gg-switch to the first line of the file

100g-switch to the file specified line

100gg

^-switch to the beginning of a line

$- switch to the end of a line

5) how to complete special editing operations

Yy-copy the specified line information

Nyy-copy multiple lines of information

P-paste the copied content on the specified line

Np-paste the copied content multiple times on the specified line

Dd-delete the specified line information (essentially cut)

Ndd-delete the specified multi-line information (essentially cut)

DG-delete all lines after the cursor

C-delete the content after the cursor and enter the editing state

R-replace the specified character information

R-continuously replace multiple character information

6) Command mode special function operation

U-withdraw operation undo

Ctrl+r-cancel the withdrawal of redo

Bottom line mode special function operation

: set nu-display line number information

: set nonu-cancel line number display

Error 04: error message is displayed and cannot be edited properly

Analyze the cause of the problem:

1) A sudden interruption occurred while editing the file

2) the file was edited by multiple users at the same time

To resolve the problem:

Problem 1: solution

The first course: recover the data information before the interruption

Vi-r Editing file information

The second course: delete a hidden file

Description: in the linux system with. The initial file is the hidden file.

Use ls-a to view hidden files

Rm-f / oldboy/oldboy.txt.swp

Common errors in editing commands

Error 01: edit commands can only edit files

Error 02: you must specify to edit the file

Error 03: edit file directory must exist

Error 04: error message is displayed and cannot be edited properly

Analyze the cause of the problem:

1) A sudden interruption occurred while editing the file

2) the file was edited by multiple users at the same time

To resolve the problem:

Problem 1: solution

The first course: recover the data information before the interruption

Vi-r Editing file information

The second course: delete a hidden file

Description: in the linux system with. The initial file is the hidden file.

Use ls-a to view hidden files

Rm-f / oldboy/oldboy.txt.swp

Principle of vi command execution

1) Editing a file results in a hidden file

2) edit the content directly in the hidden file

3) when you save a file, you rename the hidden file

Directory structure information under linux system / directory

PS: all data in the system is a file

Boot-storing boot system startup file information similar to windows system c:/windows

Etc-system service configuration file save directory

Opt/usr-the directory saved by the third software program installed by the user Program Files

Root-the home of the system user's home directory super admin user (Imperial Palace)

Home-system user's home directory the home of ordinary users (ghetto)

Var-Syslog file save directory

Tmp-temporary storage data directory is similar to the windows Recycle Bin

Sbin-binary file = = command file super Binary

Bin-binary file = = command file Binary

Dev -?

Mnt -?

Media-store audio and video pictures

Sys/proc--?

Lib-library adjust the sauce development code needs to use the library file saved directory 32-bit program required library file

Lib64-the library files required by library 64-bit programs

Official information at the directory level: http://www.pathname.com/fhs/pub/fhs-2.3.html

Summary and carding of curriculum knowledge

1) get command help information man command /-- help help / built-in command

2) operating system shortcuts

3) skills in using editing commands

4) Common errors in editing commands

5) operating system directory structure

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report