In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, the editor will share with you the relevant knowledge of what cat refers to in linux. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
In linux, the full name of cat is "concatenate", which means "connection" and can be used to connect files and print to standard output devices. The cat command can display the contents of specified files or connect several files together; the syntax "cat [option] file name" or "cat file 1 file 2 > file 3".
The operating environment of this tutorial: CentOS 6 system, Dell G3 computer.
In linux, the full name cat is "concatenate", which means "connection".
The cat command is used to connect files and print to standard output devices. This command is often used to display the contents of a file, to connect several files to display, or to read and display the contents from standard input, and it is often used in conjunction with redirection symbols.
The cat command can be used to display the contents of a text file (similar to the type command under DOS), or to attach several file contents to another file, that is, to connect the merged file.
The basic format of the cat command is as follows:
Cat [option] file name
Or
Cat File 1 File 2 > File 3
Of the two formats, the former is used to display the contents of the file, the common options and their respective meanings are shown in Table 1, while the latter is used to connect merged files.
Table 1 cat commands Common options and meanings option meaning-An is equivalent to the integration of the-vET option to list all hidden symbols;-E lists the carriage return character $at the end of each line;-n numbers all output lines;-b differs from-n, this option means that only non-blank lines are numbered. -T displays the Tab key ^ I;-V lists special characters;-s replaces it with a blank line of 1 line when it encounters more than 2 consecutive blank lines.
Note that when the cat command is used to view the contents of a file, it will be displayed at one time regardless of the content of the file. If the file is very large, the contents at the beginning of the file will not be seen. However, Linux can use the PgUp+ up arrow key to turn the page up, but this kind of page flipping has a limit, and if the file is long enough, you still can't see the contents of the whole file.
Therefore, the cat command is suitable for viewing files that are not too large. Of course, you can use other commands or methods to view large files in Linux, which we'll learn later.
[example 1] the cat command itself is very simple, and we can view the contents of the file directly. For example:
[root@localhost ~] # cat anaconda-ks.cfg
If you use the "- n" option, the line number is displayed. For example:
[root@localhost] # cat-n anaconda-ks.cfg
If you use the "- A" option, you are equivalent to using the "- vET" option to view all hidden symbols in the text, including carriage returns ($), Tab (^ I), and so on. For example:
[root@localhost] # cat-An anaconda-ks.cfg
[example 2] the contents of files file1.txt and file2.txt are merged and output to the file file3.txt.
[root@localhost base] # lsfile1.txt file2.txt [root@localhost base] # cat file1.txt http://c.biancheng.net(file1.txt)[root@localhost base] # cat file2.txtis great (file2.txt) [root@localhost base] # cat file1.txt file2.txt > file3.txt [root@localhost base] # more file3.txt#more command to view the contents of the file http://c.biancheng.net(file1.txt)is great (file2.txt) [root @ localhost base] # lsfile1.txt file2.txt file3.txt is all the content of the article "what does cat in linux refer to?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.