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

How to use the cat command of Linux

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "how to use Linux cat command". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

cat Print files, standard input content to standard output, often used to display file content, or to connect several files to display, or read content from standard input and display, often used with redirection symbols.

Parameter cat [options] [file]-A-show-all Equivalent to-vET

-b-number-nonblank output line number for nonblank pairs

-e is equivalent to-vE

-E-show-ends Display $at the end of each line

-n-Number all output lines, starting with 1 Number all output lines

-s-squeeze-blank If there are more than two consecutive blank lines, replace them with one blank line.

-t is equivalent to-vT

-T-show-tabs Display tab characters as ^I

-u List some special characters that cannot be seen (ignored)

-v-show-nonprinting Use ^and M-references except LFD and TAB

Function 1. Display the entire file at once. $ cat filename

2. Create a file from the keyboard. $ cat > filename Can only create new files, cannot edit existing files.

3. Merge several files into one file. $cat file1 file2 > file

cat -n file outputs the entire contents of the file and numbers the file starting with 1

cat -b file outputs the entire contents of the file and numbers the fiel file from 1 except for blank lines

cat file1 > file2 Write file1 to file2, overwrite file2 if file2 exists, create file2 if file2 does not exist

cat -n file1 > file2 Number file1 and write to file2

cat > file1 Write directly to file1, content from keyboard Input on console, press keyboard Ctrl+D to end input, previously input file saved in file1

cat file1 file2 > file3 Combine file1 and file2 into file3

"Linux cat command how to use" the content of the introduction here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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

Development

Wechat

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

12
Report