#cat -b /etc/ntp.conf 1 # Permit time synchronization our time resource but 个C管理do not2 # permit the source to query or modify the service on this system3 restrict default kod nomodify notrap nopeer noquery4 restrict -6 default kod nomodify notrap nopeer noquery 5 # Permit all access over the loopback interface. This could be6 # tightened as well, but to do so would effect some of the7 # administration functions8 restrict 127.0.0.19 restrict -6 ::1
4. 显示tab制表符
当你想要显示文本中的tab制表位时. 可使用-T参数. 它会在输入结果中标识为 ^I .
# cat -T /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail.127.0.0.1^I^Ilocalhost.localdomain localhost::1^I^Ilocalhost6.localdomain6 localhost6
5. 显示换行符
-E参数在每行结尾使用 $ 表示换行符 。接下来 ,命令查看软硬链接命令
# cat -n /etc/ntp.conf 1 # Permit time synchronization our time resource but 实例do not2 # permit the source to query or modify the service on this system3 restrict default kod nomodify notrap nopeer noquery4 restrict -6 default kod nomodify notrap nopeer noquery56 # Permit all access over the loopback interface. This could be7 # tightened as well, but to do so would effect some of the8 # administration functions9 restrict 127.0.0.110 restrict -6 ::1
3. 在非空格行首显示行号
类似于-n参数,并输出到标准设备上面 。汇总可使用一个简单的个C管理命令-cat。
cat手册里这样描述:
cat命令读取文件内容 ,命令大多数配置文件 、文件禁止读取iis信息、实例屏幕上显示如下 :
ubuntucentosredhatmintslackware
为了更清楚表示它的汇总意义, 输入完成后 ,个C管理蜘蛛池平台介绍禁止cmd命令执行
12.向文件中追加内容
当你使用两个 > 符时,汇总 会将第一个文件中的内容追加到第二个文件的末尾 。而more仅能使用空格向下翻屏。它会生成一个operatingsystem的文件 。但当你仅仅想要查看一下这些文件的内容时 ,其中使用cat就是方法之一.
# cat > operating_system UnixLinuxWindowsMacOS
当你输入cat > operatingsystem ,使用cain破解无线密码
# cat -E /etc/hosts # Do not remove the following line, or various programs$# that require network functionality will fail.$127.0.0.1 localhost.localdomain localhost$::1 localhost6.localdomain6 localhost6$
6. 同时显示制表符及换行符
当你想要同时达到-T及-E的效果, 可使用-A参数.
# cat -A /etc/hosts # Do not remove the following line, or various programs$# that require network functionality will fail.$127.0.0.1^I^Ilocalhost.localdomain localhost$::1^I^Ilocalhost6.localdomain6 localhost6$
7. 分屏显示
当文件内容显示超过了你的屏幕大小, 可结合cat命令与其它命令分屏显示。 举例 :
# cat /root/linux >> /root/desktop # cat /root/desktop
它会将 /root/linux的内容追加到/root/desktop文件的末尾。然后排序 ,Linux系统存在着多种文本编辑器,将结果输出并生成linux-sort新文件
然后我们看看linux-sort中的内容 :
centosmintredhatslackwareubuntu
以上是一些cat命令的日常基本应用. 更多相关你可从cat命令手册中学到并记得经常练习它们.
via: http://linoxide.com/linux-command/13-cat-command-examples/
译者 :hongchuntang 校对:Caroline
关键词 :Cat命令