Linux shell 操作命令 cat Linux shell 命令行 让你真正开始 Linux之旅,本文描述 Linux 操作命令 cat 1、简介 cat 命令是 concatenate 的缩写 2、主要功能 cat 命令的功能是将 文件 或 标准输入 组合输出 到 标准输出 3、用法/命令格式 cat[选项][文件] 4、常用参数解析
# cat /etc/hosts /etc/hosts /etc/hosts 127.0.0.1 localhost 127.0.1.1 ubuntu
# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.0.1 localhost 127.0.1.1 ubuntu
# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 127.0.0.1 localhost 127.0.1.1 ubuntu
# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 5、辅助功能 5.1 行号输出 5.1.1 显示 所有 行号
# cat -n /etc/hosts 1127.0.0.1 localhost 2127.0.1.1 ubuntu 3 4# The following lines are desirable for IPv6 capable hosts 5 ::1 localhost ip6-localhost ip6-loopback 6ff02::1 ip6-allnodes 7 ff02::2 ip6-allrouters 5.1.2 不输出 空行
# cat -b /etc/hosts 1127.0.0.1 localhost 2127.0.1.1 ubuntu
3# The following lines are desirable for IPv6 capable hosts 4 ::1 localhost ip6-localhost ip6-loopback 5ff02::1 ip6-allnodes 6 ff02::2 ip6-allrouters 5.1.3 连续 空行 只输出 一行
# cat -s /etc/hosts 127.0.0.1 localhost 127.0.1.1 ubuntu
# The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 5.2 结尾 添加 $
# cat -E /etc/hosts 127.0.0.1 localhost$ 127.0.1.1 ubuntu$ $ # The following lines are desirable for IPv6 capable hosts$ ::1 localhost ip6-localhost ip6-loopback$ ff02::1 ip6-allnodes$ ff02::2 ip6-allrouters$ 6、内容扩展 6.1 文本内容写入
6.2 反向输出文本内容 tac 是将 cat 反写过来,功能就跟 cat 相反
6.3 其他 文本 查看方式 more、less 、nl 、tail 命令工具 也可以 查看 文本内容 微信公众号 欢迎 扫码 关注 ---------------------------------------------------------------------------------------------------------------------- 我们尊重原创,也注重分享,文章来源于微信公众号:石头逍遥,建议关注公众号查看原文。如若侵权请联系qter@qter.org。 ---------------------------------------------------------------------------------------------------------------------- |