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:
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:
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
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