Linux 指令篇:档案目录管理--cat

2016-01-29 19:38 4 1 收藏

Linux 指令篇:档案目录管理--cat,Linux 指令篇:档案目录管理--cat

【 tulaoshi.com - Linux 】

  名称:cat
使用权限:所有使用者 
使用方式:cat [-AbeEnstTuv] [--help] [--version] fileName 
说明:把档案串连接后传到基本输出(萤幕或加  fileName 到另一个档案)
参数:
-n 或 --number 由 1 开始对所有输出的行数编号
-b 或 --number-nonblank 和 -n 相似,只不过对于空白行不编号
-s 或 --squeeze-blank 当遇到有连续两行以上的空白行,就代换为一行的空白行
-v 或 --show-nonprinting
范例:
cat -n textfile1  textfile2 把 textfile1 的档案内容加上行号后输入 textfile2 这个档案里
cat -b textfile1 textfile2  textfile3 把 textfile1 和 textfile2 的档案内容加上行号(空白行不加)之后将内容附加到 textfile3 里。


 范例: 
把 textfile1 的档案内容加上行号后输入 textfile2 这个档案里 
 cat -n textfile1  textfile2   
 
把 textfile1 和 textfile2 的档案内容加上行号(空白行不加)之后将内容附加到 textfile3 里。 
 cat -b textfile1 textfile2  textfile3   
 

 cat /dev/null  /etc/test.txt 此为清空/etc/test.txt档案内容 


 cat 也可以用来制作 image file。例如要制作软碟的 image file,将软碟放好后打 
 cat /dev/fd0  OUTFILE  
 
相反的,如果想把 image file 写到软碟,请打 
 cat IMG_FILE  /dev/fd0  
 

注:
   1. OUTFILE 指输出的 image 档名。
   2. IMG_FILE 指 image file。
   3. 若从 image file 写回 device 时,device 容量需与相当。
   4. 通常用在制作开机磁片。
 

来源:https://www.tulaoshi.com/n/20160129/1509839.html

延伸阅读
  名称:less 使用权限:所有使用者 使用方式:   less [Option] filename    说明:         less 的作用与 more 十分相似,都可以用来浏览文字档案的内容,不同的是 less 允许使用者往回卷动     ...
  名称 : cd 使用权限 : 所有使用者 使用方式 : cd [dirName] 说明 : 变换工作目录至 dirName。 其中 dirName 表示法可为绝对路径或相对路径。若目录名称省略,则变换至使用者的 home directory (也就是刚 login 时所在的目录)。 另...
  名称:cp 使用权限:所有使用者 使用方式: cp [options] source dest cp [options] source... directory 说明:将一个档案拷贝至另一档案,或将数个档案拷贝至另一目录。 参数:  -a 尽可能将档案状态、权限等资料都照原状予以复制。 -r 若 source 中含有目录名...
  指令名称 : ln 使用权限 : 所有使用者 使用方式 : ln [options] source dist,其中 option 的格式为 : [-bdfinsvF] [-S backup-suffix] [-V {numbered,existing,simple}] [--help] [--version] [--] 说明 : Linux/Unix&n...
名称:cut 使用权限:所有使用者 用法:cut -cnum1-num2 filename 说明:显示每行从开头算起 num1 到 num2 的文字。 范例: shell>> cat example test2 this is test1 shell>> cut -c0-6 example ## print 开头算起前 6 个字元 test2 this i cut其实很有用 -c m-n 表示显示每一行的第m个字元到第n个字元。例如: --------...

经验教程

847

收藏

91
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部