1.一次显示整个文件。$ cat filename
2.从键盘创建一个文件。$ cat >filename
只能创建新文件,不能编辑已有文件.
3.将几个文件合并为一个文件: $cat file1 file2 >file
参数:
-n 或 --number 由 1 开始对所有输出的行数编号
-b 或 --number-nonblank 和 -n 相似,只不过对于空白行不编号
-s 或 --squeeze-blank 当遇到有连续两行以上的空白行,就代换为一行的空白行
-v 或 --show-nonprinting
例:
把 textfile1 的档案内容加上行号后输入 textfile2 这个档案里
cat -n textfile1 >textfile2
把 textfile1 和 textfile2 的档案内容加上行号(空白行不加)之后将内容附加到 textfile3 里。
cat -b textfile1 textfile2 >>textfile3
把test.txt文件扔进垃圾箱,赋空值test.txt
cat /dev/null >/etc/test.txt
你用“man --help”命令就可以看到他们的解释。下面是我用这个命令得到的结果,请看:
man --help
Usage: man [OPTION...] [章节] 手册页...
-C, --config-file=文件 使用该用户设置文件
-d, --debug输出调试信息
-D, --default 将所有选项都重置为默认值
--warnings[=警告]开启 groff 的警告
主要运行模式:
-f, --whatis 等同于 whatis
-k, --apropos 等同于 apropos
-K, --global-apropos search for text in all pages
-l, --local-file
把“手册页”参数当成本地文件名来解读
-w, --where, --path, --location
输出手册页的物理位置
-W, --where-cat, --location-cat
输出 cat 文件的物理位置
-c, --catman 由 catman 使用,用来对过时的 cat
页重新排版
-R, --recode=编码output source page encoded in ENCODING
寻找手册页:
-L, --locale=区域
定义本次手册页搜索所采用的区域设置
-m, --systems=系统 use manual pages from other systems
-M, --manpath=路径 设置搜索手册页的路径为“路径”
-S, -s, --sections=列表 使用以半角冒号分隔的章节列表
-e, --extension=扩展
将搜索限制在扩展类型为“扩展”的手册页之内
-i, --ignore-case 查找手册页时不区分大小写字母
(默认)
-I, --match-case 查找手册页时区分大小写字母。
--regexshow all pages matching regex
--wildcard show all pages matching wildcard
--names-only make --regex and --wildcard match page names only,
not descriptions
-a, --all 寻找所有匹配的手册页
-u, --update 强制进行缓存一致性的检查
--no-subpages don't try subpages, e.g. 'man foo bar' =>'man
foo-bar'
控制格式化的输出:
-P, --pager=PAGER 使用 PAGER 程序显示输出文本
-r, --prompt=字符串 给 less pager 提供一个提示行
-7, --ascii显示某些 latin1 字符的 ASCII 翻译形式
-E, --encoding=编码 use selected output encoding
--no-hyphenation, --nh turn off hyphenation
--no-justification, --nj turn off justification
-p, --preprocessor=字符串 字符串表示要运行哪些预处理器:
e - [n]eqn, p - pic, t - tbl,
g - grap, r - refer, v - vgrind
-t, --troff使用 groff 对手册页排版
-T, --troff-device[=设备] 使用 groff 的指定设备
-H, --html[=浏览器] 使用 www-browser 或指定浏览器显示 HTML
输出
-X, --gxditview[=分辨率] 使用 groff 并通过 gxditview (X11)
来显示:
-X = -TX75, -X100 = -TX100, -X100-12 = -TX100-12
-Z, --ditroff 使用 groff 并强制它生成 ditroff
-?, --help give this help list
--usagegive a short usage message
-V, --version print program version
man是一个查看帮助文档的命令。man简介:
帮助命令:man
命令名称:man
命令英文原意:manual
命令所在路径:/usr/bin/man
执行权限:所有用户
语法:man [命令或配置文件]
功能描述:获得帮助信息
范例: $ man ls
查看ls命令的帮助信息。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)