The cat of the Linux Common Operation command

Source: Internet
Author: User

Cat: Display text file

You can use the Cat command to display the contents of a text file, or you can append the contents of several files to another file. If no file is specified, or if the file is "-", it is read from the standard input.

Command syntax:

Cat [Options] [file]

Options:

-N: Numbering all lines of the output

-B: Number of non-null output lines

-S: Displays a blank line in a row when a row is encountered

-e: Show $ at end of each line

Example:

  1. Displays the contents of the/etc/inittab  file [[email protected] ~]# cat /etc/inittab # inittab  is only used by upstart for the default runlevel.## adding  other configuration here will have no effect on your system.##  System initialization is started by /etc/init/rcS.conf## Individual  Runlevels are started by /etc/init/rc.conf## ctrl-alt-delete is handled  by /etc/init/control-alt-delete.conf## terminal gettys are handled by  /etc/init/tty.conf and /etc/init/serial.conf,# with configuration in /etc/ sysconfig/init.## for information on how to write upstart event  Handlers, or how# upstart works, see init (5),  init (8), and  Initctl (8). ## default runlevel. the runlevels used are:#   0 - halt  (Do NOT  set initdefault to this) #   1 - single user mode#    2 - Multiuser, without NFS  (the same as 3, if  you do not have networking) #   3 - full multiuser  mode#   4 - unused#   5 - x11#   6  - reboot  (do not set initdefault to this) # id:3:initdefault:
  2. Enter the contents of the file test1 with the line number into the test2 file [[email protected] data]# cat-n test1>>test2[[email protected] data]# cat Test2 1 SFSG 2 Faqeg 3 AGSG
  3. Create a file Test1 file using the cat command [[email protected] data]# cat >test1<<eof #开头和结尾的EOF可用任意字符替换, used eofsfsgfaqegagsgeof[[ Email protected] data]# cat test1 #查看tes1中的文件内容sfsgfaqegagsg

This article is from the "Linux Learning log" blog, so be sure to keep this source http://zjmlinux.blog.51cto.com/4684186/1982955

The cat of the Linux Common Operation command

Related Article

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.