linux下cat命令详解(linux under cat command detailed)

上传人:xins****2008 文档编号:114985975 上传时间:2019-11-12 格式:DOC 页数:10 大小:30.50KB
返回 下载 相关 举报
linux下cat命令详解(linux under cat command detailed)_第1页
第1页 / 共10页
linux下cat命令详解(linux under cat command detailed)_第2页
第2页 / 共10页
linux下cat命令详解(linux under cat command detailed)_第3页
第3页 / 共10页
linux下cat命令详解(linux under cat command detailed)_第4页
第4页 / 共10页
linux下cat命令详解(linux under cat command detailed)_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《linux下cat命令详解(linux under cat command detailed)》由会员分享,可在线阅读,更多相关《linux下cat命令详解(linux under cat command detailed)(10页珍藏版)》请在金锄头文库上搜索。

1、linux下cat命令详解(Linux under cat command detailed)Linux under cat command detailedAbridged edition:Cat has three main functions:1. displays the entire file at a time. $cat filename2. create a file from the keyboard. $cat filenameOnly new files can be created, and existing files cannot be edited3. combi

2、ne several files into one file: $cat, file1, File2 fileParameter:The -n or -number starts with 1 and the number of rows for all outputs is numbered-b or -number-nonblank is similar to -n except that the blank line is not numbered-s or -squeeze-blank, when it encounters a blank row of more than two l

3、ines, is replaced with a blank row of rows-v or -show-nonprintingCases:Add the file number of the textfile1 to the textfile2 file after adding the line numberCat, -n, textfile1 textfile2Append the file contents of textfile1 and textfile2 to the line number (blank line is not added) and append the co

4、ntents to textfile3.Cat -b textfile1 textfile2 textfile3Throw the test.txt file into the trash box and assign the value to test.txtCat /dev/null /etc/test.txtDetailed:Turn: http:/ is a text file view and connection tool. To view the contents of a file, using cat is relatively simple, that is, cat di

5、rectly followed by the file name.Such as:Derootlocalhost cat /etc/fstabde #To help novice brothers master this tool flexibly, lets say a few more common parameters;1 cat syntax structure;Decat options files. Deoption-A, -show-all is equivalent to -vET-b, -number-nonblank for non null output line num

6、bers-e is equivalent to -vE-E, -show-ends displays $at the end of each line-n, -number for all lines of output-s, -squeeze-blank does not output multiple rows of blank lines-t and -vT are equivalent-T, -show-tabs displays the skip character as I-u (ignored)-v, -show-nonprinting uses and M- reference

7、s, except for LFD and TAB-help displays this help information and leaves1.1 cat view file content instance;Note: profile /etc/profile cat derootlocalhost # to view the contents of the file under the /etc/ directory;rootlocalhost # cat -b /etc/fstab note: profile to view the contents of the /etc/ dir

8、ectory, and the number of non blank line line number, starting from 1;rootlocalhost # cat -n /etc/profile note: all the rows in the /etc directory of the profile (including blank line) number display;rootlocalhost # cat -E /etc/profile note: profile to view the contents of the /etc/, and in each lin

9、e at the end of the additional $de symbols;The cat plus parameter -n is similar to the NL tool, and the line number is added in front of each row while the file content is output;Derootlocalhost cat -n /etc/profile #rootlocalhost NL /etc/profilede #Cat can display the contents of multiple files at t

10、he same time, for example, we can display the contents of two files at the same time on a cat command;Derootlocalhost cat /etc/fstab /etc/profilede #Cat for the content of great files, can be sent to the more through the pipeline | tool, and then see a page;Derootlocalhost cat /etc/fstab /etc/profil

11、e morede | #1.2 cat creation, connection file function examples;Cat has the ability to create files. After you create a file, you want to end it with EOF or STOP;Derootlocalhost # cat linuxsir.org.Txt EOF note: create linuxsir.org.txt file; Ill test cat, create the file, and enter the contents for t

12、he file. Note: This is to enter the contents for the linuxsir.org.txt file; north, South, North and South test. Note: This is to enter the contents for the linuxsir.org.txt file; EOF note: exit edit status;rootlocalhost # cat linuxsir.org.txt note: we check the contents of the linuxsir.org.txt file;

13、Ill test cat, create the file, and enter the contents for the file;North, South, North and South tests; deCat also has the capability to append content to existing files;Derootlocalhost # cat linuxsir.txt note: linuxsir.txt file to view the contents of the existing;I, am, BeiNanNanBei, From, LinuxSi

14、r.Org. Note: content lineIm writing a document for the cat commandrootlocalhost cat linuxsir.txt EOF # note: we append to the linuxsir.txt file; Ill test the cats ability to append content to the document; note: This is the content that was recovered OK? OK ! north, South, upward EOF note: exit with

15、 EOF;rootlocalhost cat linuxsir.txt # note: view the contents of the documents, to see whether successful recovery.I, am, BeiNanNanBei, From, LinuxSir.OrgIm writing a document for the cat commandIll test the cats ability to append content to the document;OK?OK North and South are on deCat connects the conten

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号