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

Use the cat command of linux to display the contents of the file on the end device

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

Share

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

This article will explain in detail about using the cat command of linux to display the contents of the file on the terminal device. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

There are many commands for viewing the contents of files in the Linux system, and each command has its own characteristics. For example, this cat command is used to view plain text files with less content. The command cat is also easy to remember, because cat means "cat" in English. Does the kitten give you a petite and lovely feeling?

Note: when the file content is large, the text content will flash quickly on the screen (scroll screen), the user often can not see the specific content displayed clearly. Therefore, for longer file contents, you can press the Ctrl+ S key to stop scrolling; and the Ctrl+ Q key to resume scrolling; and press the Ctrl+C key to terminate the execution of the command. Or for large files, simply use the more command!

Syntax format: cat [parameters] [file]

Common parameters:

-n displays the number of lines (blank lines are also numbered)-s displays the number of lines (multiple blank lines are counted as a number)-b displays the number of lines (blank lines are not numbered)-E displays the $symbol at the end of each line

-T displays TAB characters as ^ I symbols-v uses ^ and M-references, except for LFD and TAB,-e is equivalent to "- vE" combination-t

Equivalent to "- vT" combination-An is equivalent to-vET combination-help display help information-version display version information

Reference example

View the contents of the file:

[root@linuxcool ~] # cat filename.txt

View the contents of the file and display the line number:

[root@linuxcool] # cat-n filename.txt

View the contents of the file, add a line number and output to another file:

[root@linuxcool ~] # cat-n linuxcool.log > linuxprobe.log

Clear the contents of the file:

[root@linuxcool ~] # cat / dev/null > / root/filename.txt

Continue to write the contents of the file, end when you encounter the EOF character and save:

[root@linuxcool ~] # cat > filename.txt Linux!

> EOF

Make the floppy device into an image file:

[root@linuxcool ~] # cat / dev/fd0 > fdisk.iso so much for using linux's cat command to display files on terminal devices. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

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