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

Linux Note 4 Linux commands that beginners must master

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

Share

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

2.6 text file editing command

1.cat command

The cat command is used to view plain text files (those with less content) in the format "cat [options] [files]".

2.more command

The more command is used to view plain text files (those with more content) in the format "more [options] file".

3.head command

The head command is used to view the first N lines of a plain text document in the format "head [options] [File]".

4.tail command

The tail command is used to view the last N lines of a plain text document or to continuously refresh the contents in the format "tail [options] [File]".

5.tr command

The tr command is used to replace characters in a text file in the format "tr [original character] [target character]".

6.wc command

The wc command is used to count the number of lines, words, and bytes of the specified text in the format "wc [parameter] text".

Wc parameters and action parameters function-l displays only the number of lines-w shows only the number of words-c shows only the number of bytes

7.stat command

The stat command is used to view the specific storage information, time and other information of the file in the format of "stat file name".

8.cut command

The cut command is used to extract text characters by column, formatted as "cut [parameter] text"

If you search by column, you need to use not only the-f parameter to set the number of columns you want to see, but also the-d parameter to set the interval symbol.

9.diff command

The diff command is used to compare the differences of multiple text files in the format "diff [parameters] file".

2.7 File directory management commands

1.touch command

The touch command is used to create a blank file or to set the time of the file in the format "touch [options] [File]".

The parameters and functions of touch command

Parameter function-an only modifies "read time" (atime)-m modifies only "modification time" (mtime)-d modifies both atime and mtime

2.mkdir command

The mkdir command is used to create a blank directory in the format "mkdir [options] directory".

3.cp command

The cp command is used to copy a file or directory in the format "cp [options] source file destination file". You should be familiar with file copy operations. In Linux systems, copy operations can be divided into three types:

If the target file is a directory, the source file is copied to that directory

If the target file is also a normal file, you will be asked if you want to overwrite it

If the destination file does not exist, the normal copy operation is performed.

The parameters and functions of cp command

Parameter function-p retains the attributes of the original file-d if the object is a "linked file" Keep the attributes of the "linked file"-r recursive continuous copy (for directories)-I if the target file exists, ask whether to overwrite-an is equivalent to-pdr (p, d, r are the above parameters)

4.mv command

The mv command is used to cut or rename a file in the format "mv [option] source file [destination path | destination file name]".

5.rm command

The rm command is used to delete a file or directory in the format rm [options] file.

2.8 package Compression and search commands

1.tar command

The tar command is used to package, compress or extract files in the format "tar [options] [files]".

The-c parameter is used to create compressed files, and the-x parameter is used to extract files, so these two parameters cannot be used at the same time. Second, the-z parameter specifies that the file is compressed or decompressed using the Gzip format, and the-j parameter specifies that the file is compressed or decompressed using the bzip2 format.

2.grep command

The grep command is used to perform a keyword search in text and display matching results in the format "grep [options] [File]".

-c displays only the number of rows found

-I ignore case

-n display line number

3.find command

The find command is used to find files according to the specified criteria in the format "find [lookup path] find conditional action".

-prune ignores a directory

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