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

The sixth day course of Linux operation and maintenance

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

Share

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

1. Operating system basic management commands

two。 Operating system shortcuts use

3. Operating system Editing Command vi

4. How to view the system command help manual

5. Directory structure of the system

Some commands related to the file directory

Backup system data information copy = > cp copy command

Syntax format: cp parameter source file (backup file required) destination file (file after backup)

Backup file information [root@zhanglei / oldboy] # cp / oldboy/abc / oldboy/abc.txt

Supplement: overwrite file problem

If you copy a file normally, you will be prompted to overwrite:

[root@zhanglei / oldboy] # cp / oldboy/abc / oldboy/abc.txt

Cp: overwrite'/ oldboy/abc.txt'? Y

[root@zhanglei / oldboy] # cat / oldboy/abc.txt

Lei

How to force an override:

Method 1:\ cp oldboy01.txt / opt/-ignore the override prompt

Method 2: / usr/bin/cp oldboy01.txt / opt/-ignore the override prompt

Backup directory information cp-r oldboy 2. System data information move operation (cut move) = > mv syntax format: mv parameter source file (need to move file) move file information: mobile directory information: [root@zhanglei ~] # mv / oldboy/ / tmp/ [root@zhanglei ~] # ls / tmp/ oldboy rename operation [root@zhanglei ~] # mv / tmp / oldboy/ / tmp/lei [root@zhanglei ~] # ls / tmp/lei

3. System data deletion command remove = = rm

Delete file information

[root@zhanglei ~] # rm-f oldzhang/lei.txt [root@zhanglei ~] # ls oldzhang/lei.txt delete directory information rm-r / oldboy/-f forcibly delete directory data information (without confirmation prompt)-r recursively delete the information under the directory delete root operation: rm-rf-- no-preserve-root / rm-rf / * 4. Common system shortcuts:

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 to the left and right according to the word character

Ctrl + w-Delete (cut) a contiguous string of information (no space division)

Ctrl + y-paste cut information

Ctrl + u-removes (cuts) all string information to the left of the cursor location

Ctrl + k-removes (cuts) all string information to the right of the cursor location

Usage and skills of 5.vi command

The vi command has three modes:

1) Command mode: the first mode to open a file for editing

2) Editing mode: you can modify the file information directly

3) bottom line mode: enter vi editing instruction information to complete different functions

Command mode → editing mode "I"

Edit mode-- esc-- command mode

Command mode-bottom line mode

Bottom line mode-- esc-- command mode

Tips for using Vi commands: 1) move the cursor quickly

G/shift + g-quickly switch the cursor to the last line

Gg-quickly switch the cursor to the beginning of the file line

10gg-Quick the cursor to the specified line

$- quickly switch the cursor to the end of the line

0 / ^-quickly switch the cursor to the beginning of the line

2) move the cursor quickly and enter the editing state o-place the cursor on a new line below the current line and modify it O-move the cursor on a new line above the current line and modify I-enter edit mode I -switch the cursor to the beginning of the line and enter edit mode A-switch the cursor to the end of the line and enter edit mode a-enter the next character in the current position of the cursor into edit mode C-place the cursor All content on the right is cleared into edit mode cc-clear the entire line of content And enter the editing state 3) quickly edit the file content information yy-copy the specified content information nyy-copy multi-line information p-paste the copied or cut information 3p-paste the copied or cut content 3 times Dd-delete (cut) specify one line of information ndd-delete (cut) specify multiple lines of information dG-delete (cut) everything after the line of the cursor r-replace the character information R where the specified cursor is located -enter into replacement mode Can replace multiple character information 4) bottom line function instruction set nu-display line number information set nonu-cancel display line number information: s/oldboy/oldgirl/-replace cursor location information:% s/oldboy/oldgirl/-replace all in the file Specified content: 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 4, 3, 3, 4, 3, 4, 4, 3, 4, 4, 4, 3, 3, 4, 4, 4, 3, 4, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 4, 4, 3, 3, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 4, 6. S/oldboy/oldgirl/-replace the specified line to the last line of specified content: 6 PS: when the replacement instruction is used, replace all the matching information retrieved in the line: 6 Segmentation symbol can use / / # # @ / search information-retrieve and filter specified information in the file n means to retrieve the next matching information N means to return to the previous matching information / search Information\ c-ignore case special operation skills in file retrieval u-undo vi edit undo operation ctrl + r-redo vi edit cancel undo operation: when 01.vi edits file information What does it mean if prompted by the following information? How not to display the following information 2.vi editing file principle process? 3. Summarize and understand the directory structure of the system

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