Linux Cat commands

Source: Internet
Author: User

1.cat Command function

The purpose of the cat command is to connect files or standard input and print. This command is commonly used to display the contents of a file, or to connect several files to display, or to read from a standard input and display it, often in conjunction with redirection symbols

2.CAT command format

     cat  [option] ... [File] ...

3.cat command parameter

  -A, --show-all            equivalent to  -vet   -b, --number-nonblank     number of non-null output lines   -e                          equivalent to  -vE  -E, --show-ends           Show at the end of each line  $  -n, --number               all row numbering for the output   -s, --squeeze-blank       do not output multiple lines of blank lines    -t                         and  -vT  equivalence   -T, --show-tabs            show the jump character as  ^I  -u                         (ignored)   -v, -- show-nonprinting    use  ^  and  M-  references, except  LFD  and  TAB         --help                 Display this help message and leave

4.cat Command Instance

      a. viewing file contents

 #cat   file name [[Email protected] ~]# cat demo.txt     aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccdddddddddddddddddddd#cat  -n  file name   display content line number [[email protected] ~]# cat -n demo.txt       1  aaaaaaaaaaaaaaaaaaaa     2   bbbbbbbbbbbbbbbbbbbb     3  ccccccccccccccccccccc      4  dddddddddddddddddddd[[email protected] ~]# cat -ne demo.txt       1  aaaaaaaaaaaaaaaaaaaa$     2   bbbbbbbbbbbbbbbbbbbb$     3  ccccccccccccccccccccc$      4  dddddddddddddddddddd$ 

Strong>    b.cat Create a file and append content, or append content to an existing file

[[email protected] ~]# cat > text.txt  aaaaaaaavvvvvvvv[[email  protected] ~]# lltotal 96drwxr-xr-x 2 root root  4096 dec  &NBSP;6&NBSP;00:40&NBSP;AAAA-RW------- 1 root root   909 mar  8   2016 anaconda-ks.cfg-rw-r--r-- 1 root root     5  dec  9 01:25 a.txt-rw-r--r-- 1 root root    85  dec  9 01:08 demo.txt-rw-r--r-- 1 root root    81  jan 12  2010 index.html-rw-r--r-- 1 root root 36494 mar   8  2016 install.log-rw-r--r-- 1 root root  3849 mar   8  2016 install.log.syslog-rw-r--r-- 1 root root     18 dec  9&nbsP;01:27 text.txt[[email protected] ~]# cat >> b.txt <<eof>  aaaaaaaaaaaaaaaaa> bbbbbbbbbbbbbbbbbbb> ccccccccccccccccc> EOF[[email  protected] ~]# ll-bash: ll: command not found[[email protected] ~]#  lltotal 104drwxr-xr-x 2 root root  4096 dec  6 00:40 &NBSP;AAAA-RW------- 1 root root   909 mar  8  2016  anaconda-ks.cfg-rw-r--r-- 1 root root     5 Dec   9 01:25 a.txt-rw-r--r-- 1 root root    56 dec  9  01:30 b.txt-rw-r--r-- 1 root root    85 dec  9  01:08 demo.txt-rw-r--r-- 1 root root    81 jan 12   2010 index.html-rw-r--r-- 1 root root 36494 mar  8  2016 install.log-rw-r--r--  1 root root  3849 Mar  8  2016  install.log.syslog-rw-r--r-- 1 root root    18 dec  9  01:27 text.txt

Strong>     C.cat connect the contents of multiple files and output them to a new file

[email protected] ~]# cat A.txtaaaa[[email protected] ~]# cat B.txtaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbccccccccccccccccc[[email protected] ~]# cat Demo.txtaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccdddddddddddddddddddd[[email protected] ~]# Cat a.txt B.txt >> demo.txt[[email protected] ~]# cat Demo.txt aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbb Bcccccccccccccccccccccddddddddddddddddddddaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbccccccccccccccccc



Linux Cat commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.