您当前的位置: 首页 >  linux

我什么都布吉岛

暂无认证

  • 4浏览

    0关注

    292博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

每天学点Linux(五)cat命令

我什么都布吉岛 发布时间:2018-07-02 11:08:45 ,浏览量:4

cat(concatenate)拼接文件并将其输出标准输出。

SYNOPSIS
       cat [OPTION]... [FILE]...

DESCRIPTION
       Concatenate FILE(s) to standard output.

       With no FILE, or when FILE is -, read standard input.

       -A, --show-all
              equivalent to -vET

       -b, --number-nonblank
              number nonempty output lines, overrides -n

       -e     equivalent to -vE

       -E, --show-ends
              display $ at end of each line

       -n, --number
              number all output lines

       -s, --squeeze-blank
              suppress repeated empty output lines

       -t     equivalent to -vT

       -T, --show-tabs
              display TAB characters as ^I

       -u     (ignored)

       -v, --show-nonprinting
              use ^ and M- notation, except for LFD and TAB

       --help display this help and exit

       --version
              output version information and exit

例子:

  • 查看文件内容cat apple.txt
  • 查看文件内容,从1开始行(含空格)编号 cat -n apple.txt
  • 查看文件内容,从1开始行(不含空格)编号 cat -b apple.txt
  • 清空文件内容,cat /dev/null > apple.txt
  • 结尾显示$(可以用来查看末尾是否含有空格) cat -E apple.txt
  • 合并两个文件内容到另一个文档,cat a.txt b.txt >> ab.txt

PS:终端中输入cat>文件,接下来终端的输入都会被写到文件中,直到用户按下ctrl+d

关注
打赏
1658157489
查看更多评论
立即登录/注册

微信扫码登录

0.0423s