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

Cat command

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The cat command is originally used to connect the contents of multiple files, but it is more often used to view the contents of files in practice, and it is often used in conjunction with redirection.

1. Command format:

Cat [options] [File]

two。 Command function:

Cat has three main functions.

1. Display the entire file at once

two。 Create a file from the keyboard

3. Merge several files into one file

3. Common command parameters

-A, all

-b, for non-empty outgoing line number

-n, numbering all lines of output, starting with 1, numbering the lines of all output

-s, if there are more than two blank lines in a row, replace it with a blank line

4. Use an example

Example 1: view / opt/test1.txt

Command: cat / opt/test1.txt

Example 2: create a file test2.txt (in the / opt directory) with cat, and the content is: my name is cat command: cat > test2.txt.

Example 3: view both test1.txt file and test2.txt file command cat / opt/test1.txt / opt/test2.txt

Example 4: merge the contents of test1 and test2 files into a new file test3

Command: cat / opt/test1.txt / opt/test2.txt > test3

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