In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to use the cat command in Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Linux common command cat (English full spelling: concatenate) command is used to connect files and print to standard output devices
Cat connects multiple files and prints to standard output.
Summary cat [OPTION]... [FILE]... The main purpose is to display the contents of the file, if there is no file or the file is -, then read the standard input.
Connect the contents of multiple files and print them to standard output.
Displays invisible characters (control characters, newline characters, tabs, and so on) in the contents of the file.
Parameter FILE (optional): the file to be processed can be one or more.
Option long option is equivalent to short option-A,-- show-all is equivalent to "- vET" combination option. -b,-- number-nonblank only numbers non-blank lines, starting with 1, overriding the "- n" option. -e is equivalent to the "- vE" combination option. -E,-- show-ends displays the'$'character at the end of each line. -n,-- number numbers all lines, starting with 1. -s,-- squeeze-blank compresses consecutive blank lines to one line. -t is equivalent to the "- vT" combination option. -T,-- show-tabs uses "^ I" for TAB (tabs). -u POSIX compatibility option, meaningless. -v,-- show-nonprinting uses "^" and "M -" symbols to display control characters, except for LFD (line feed, the newline character'\ n') and TAB (tab). -- help displays help information and exits. -- version displays version information and exits. The return status of the return value is successful unless an illegal option or parameter is given.
Example # merge and display multiple files cat. / 1.log. / 2.log. / 3.log # to show non-print characters, tab, Line feed character cat-A test.log # empty line cat-s test.log # displays the file and appends the line number cat-n test.log # to the beginning of all lines and the line number cat-b test.log # to the beginning of all non-blank lines to display echo'# 'together with the file contents. | cat-test.log Note that this command is a command in the GNU coreutils package. For help, please see man-s 1 cat or info coreutils' cat invocation'.
When using the cat command to view larger files, the text flashes quickly on the screen (scrolling), the user often can not see the content displayed clearly, in order to control the scrolling, you can press the Ctrl+ s key to stop scrolling; press the Ctrl+ Q key to resume scrolling; press the Ctrl+c (interrupt) key to terminate the execution of the command and return to the Shell prompt.
It is recommended that you use less, more commands or text editors such as emacs or vi when viewing larger files.
This is the end of this article on "how to use the cat command in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please 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.
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.