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

CentOS 7 commands for managing directory files

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces in detail the command of centOS 7 to manage directory files. The sample code in this article is very detailed. It is easy to learn and is very suitable for beginners.

Simple operation of the cat;more;less;head;tail;wc;grep;bzip2;tar;vi;vim command

1.cat

View all the contents of a file at once; not suitable for reading large documents

2.more

Can be viewed by page; flexible; spacebar to turn the page; line by line to view using enter key; exit view using Q key

3.less

Support paging view; support page up and down; support content search; pgup page up; pgdown page down

4.cat and more are used together

5.head

View the start line, and view the first 10 rows of data by default

6.tail

View the last row, and view the last 10 rows of data by default

7.wc statistics file

Common options for wc

-l statistical lines;-w statistics on the number of words;-c statistics on size

8.grep

Common options for grep

-I ignore case

-v reversal

9.gzip file compression and decompression

Common options for gzip

-Q high compression

-d unzip the compressed file

Common options for 10.bzip2

-Q high compression

-d decompression

Common options for 11.tar Archive Command

-c create a compressed file

-x extract the file

-C extract to the specified directory

-v display details

-z create compressed and decompressed files using gzip

-j create compressed or unzipped files using bzip2

-p Compression keeps the file directory permissions unchanged

-t view a list of compressed data

-P keep the compressed source file directory unchanged

12.vi and vim

Three modes of vi

1) Command mode

Adjust the cursor position; copy, delete, paste and use

2) insert mode

Modify text usage; add, modify, update data usage

3) Last row mode

Save find replace text file use

4) switch between modes

Command to enter insert mode

I insert data in front of the cursor; An insert data at the end of the row where the cursor is located; o insert data in the next row of the row where the cursor is located

Return input mode to command mode

Use the ESC key

5) Last row mode

Use esc to enter:

6) inline jump

^ reach the beginning of the line; o reach the beginning of the line; $t reach the end of the line

7) Jump between lines

Gg quickly reaches the beginning of the line; G quickly reaches the end of the line; logg quickly reaches line 10

8) copy

Yy copies a row of data; 5yy copies 5 rows of data after the cursor

9) paste

P

10) Delete

Dd deletes the whole row of data

X Delete the location data of the cursor

Delete the data in front of the cursor

D $data after cursor deletion

11) undo deletion

Undo one-time u

Undo multiple use of U (uppercase)

12) Last row mode

W save

: X save and exit

Wq saves and exits

: wq! Force save and exit

: q! Forced exit

Q quit editing and do not save

13) replace

1 s/h/bb/g 20 change the h of line 1 to 20 with bb

:% s/b/dd/g changes the b of the whole file into dd

After reading the contents of the appeal, have you mastered the method of centOS 7's command to manage directory files? If you want to know more about it, welcome to follow the industry information channel!

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