每天一个Linux命令(1) cat

cat 猫 这里是猫的意思吗?
man cat看一下有啥用? 是啥意思?
Name:cat -concatenate files and print on the standard output
Synopsis: cat [option]...[file]...
Description: Concatenate Files or standard input ,to standard output.
翻译一下几个不认识的词:concatenate联结 Synopsis概要;简介
由此可见其有两个作用:
1.联结文件
2.标准输出
cat的三大功能:
1.cat testcat01.txt 查看某个具体文件全部内容
2.cat > testcat02.txt 创建新文件,并且会直接让你编辑。
3.cat testcat01.txt testcat02.txt > testcat03.txt 将多个文件合并到一个文件
接下来就看看那些具体的操作吧(只列一部分):

cat -b testcat01.txt
对非空输出行编号
cat -n testcat02.txt
对所有输出行编号
cat -s testcat03.txt
将有连续两行空行及以上的缩为一行空行
cat -e testcat01.txt
每行结束都有一个$符号,空行也有
cat -T 将Tab显示为^I

PS:cat 是从上往下看 tac是从下往上看 反过来就可以了。

CAT(1) NAME

   cat - concatenate files and print on the standard output

SYNOPSIS

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

DESCRIPTION

   Concatenate FILE(s), or standard input, to standard output.

   -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

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

EXAMPLES

   cat f - g
          Output f's contents, then standard input, then g's contents.

   cat    Copy standard input to standard output.

   GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report cat translation bugs to <http://translationproject.org/team/>

AUTHOR

   Written by Torbjorn Granlund and Richard M. Stallman.

COPYRIGHT

   Copyright © 2013 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
   This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.

SEE ALSO

   tac(1)

   The full documentation for cat is maintained as a Texinfo manual.  If the info and cat programs are properly installed at your site, the command

          info coreutils 'cat invocation'

   should give you access to the complete manual.

GNU coreutils 8.22
相关链接:每天一个Linux命令(2) chattr

本文链接:

https://heyzen.club/index.php/Coder/36.html
1 + 8 =
快来做第一个评论的人吧~