linux cat命令什么意思 linux 中cat什么意思

linux cat >> \u547d\u4ee4

cat \u547d\u4ee4\u7528\u4e8e\u8fde\u63a5\u6587\u4ef6\u5e76\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u8bbe\u5907\u4e0a\u3002cat\u662fconcatenate\u7684\u7b80\u5199\uff0c\u7c7b\u4f3c\u4e8edos\u4e0b\u9762\u7684type\u547d\u4ee4\uff0c\u4f7f\u7528\u6743\u9650\u4e3a\u6240\u6709\u4f7f\u7528\u8005\u3002
cat file1 >> file2\u7684\u610f\u601d\u662f\u628a file1 \u7684\u6587\u6863\u5185\u5bb9\u8f93\u5165file2 \u8fd9\u4e2a\u6587\u6863\u91cc\u3002

\u6269\u5c55\u8d44\u6599\uff1a
cat\u7684\u8bed\u6cd5\u683c\u5f0f\uff1a
cat [-AbeEnstTuv] [--help] [--version] fileName
\u53c2\u6570\u8bf4\u660e\uff1a
-n \u6216 --number\uff1a\u7531 1 \u5f00\u59cb\u5bf9\u6240\u6709\u8f93\u51fa\u7684\u884c\u6570\u7f16\u53f7\u3002
-b \u6216 --number-nonblank\uff1a\u548c -n \u76f8\u4f3c\uff0c\u53ea\u4e0d\u8fc7\u5bf9\u4e8e\u7a7a\u767d\u884c\u4e0d\u7f16\u53f7\u3002
-s \u6216 --squeeze-blank\uff1a\u5f53\u9047\u5230\u6709\u8fde\u7eed\u4e24\u884c\u4ee5\u4e0a\u7684\u7a7a\u767d\u884c\uff0c\u5c31\u4ee3\u6362\u4e3a\u4e00\u884c\u7684\u7a7a\u767d\u884c\u3002
-v \u6216 --show-nonprinting\uff1a\u4f7f\u7528 ^ \u548c M- \u7b26\u53f7\uff0c\u9664\u4e86 LFD \u548c TAB \u4e4b\u5916\u3002
-E \u6216 --show-ends : \u5728\u6bcf\u884c\u7ed3\u675f\u5904\u663e\u793a $\u3002
-T \u6216 --show-tabs: \u5c06 TAB \u5b57\u7b26\u663e\u793a\u4e3a ^I\u3002
-A, --show-all\uff1a\u7b49\u4ef7\u4e8e -vET\u3002
-e\uff1a\u7b49\u4ef7\u4e8e"-vE"\u9009\u9879\uff1b
-t\uff1a\u7b49\u4ef7\u4e8e"-vT"\u9009\u9879\uff1b
\u6bd4\u5982\uff1a
\u628a textfile1 \u7684\u6587\u6863\u5185\u5bb9\u52a0\u4e0a\u884c\u53f7\u540e\u8f93\u5165 textfile2 \u8fd9\u4e2a\u6587\u6863\u91cc\uff1a
cat -n textfile1 > textfile2
\u53c2\u8003\u8d44\u6599\uff1acat(linux\u547d\u4ee4)-\u767e\u5ea6\u767e\u79d1

cat\u4e3b\u8981\u6709\u4e09\u5927\u529f\u80fd\uff1a
1.\u4e00\u6b21\u663e\u793a\u6574\u4e2a\u6587\u4ef6\u3002$ cat filename
2.\u4ece\u952e\u76d8\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6\u3002$ cat > filename
\u53ea\u80fd\u521b\u5efa\u65b0\u6587\u4ef6,\u4e0d\u80fd\u7f16\u8f91\u5df2\u6709\u6587\u4ef6.
3.\u5c06\u51e0\u4e2a\u6587\u4ef6\u5408\u5e76\u4e3a\u4e00\u4e2a\u6587\u4ef6\uff1a $cat file1 file2 > file
\u53c2\u6570\uff1a
-n \u6216 --number \u7531 1 \u5f00\u59cb\u5bf9\u6240\u6709\u8f93\u51fa\u7684\u884c\u6570\u7f16\u53f7
-b \u6216 --number-nonblank \u548c -n \u76f8\u4f3c\uff0c\u53ea\u4e0d\u8fc7\u5bf9\u4e8e\u7a7a\u767d\u884c\u4e0d\u7f16\u53f7
-s \u6216 --squeeze-blank \u5f53\u9047\u5230\u6709\u8fde\u7eed\u4e24\u884c\u4ee5\u4e0a\u7684\u7a7a\u767d\u884c\uff0c\u5c31\u4ee3\u6362\u4e3a\u4e00\u884c\u7684\u7a7a\u767d\u884c
-v \u6216 --show-nonprinting
\u4f8b\uff1a
\u628a textfile1 \u7684\u6863\u6848\u5185\u5bb9\u52a0\u4e0a\u884c\u53f7\u540e\u8f93\u5165 textfile2 \u8fd9\u4e2a\u6863\u6848\u91cc
cat -n textfile1 > textfile2

\u628a textfile1 \u548c textfile2 \u7684\u6863\u6848\u5185\u5bb9\u52a0\u4e0a\u884c\u53f7\uff08\u7a7a\u767d\u884c\u4e0d\u52a0\uff09\u4e4b\u540e\u5c06\u5185\u5bb9\u9644\u52a0\u5230 textfile3 \u91cc\u3002
cat -b textfile1 textfile2 >> textfile3

\u628atest.txt\u6587\u4ef6\u6254\u8fdb\u5783\u573e\u7bb1\uff0c\u8d4b\u7a7a\u503ctest.txt
cat /dev/null > /etc/test.txt

cat命令是linux下的一个文本输出命令,通常是用于观看某个文件的内容的;
cat主要有三大功能:
1.一次显示整个文件。
$ cat filename
2.从键盘创建一个文件。
$ cat > filename
只能创建新文件,不能编辑已有文件.
3.将几个文件合并为一个文件。
$cat file1 file2 > file
cat具体命令格式为 : cat [-AbeEnstTuv] [--help] [--version] fileName
说明:把档案串连接后传到基本输出(屏幕或加 > fileName 到另一个档案)
参数:
-n 或 –number 由 1 开始对所有输出的行数编号
-b 或 –number-nonblank 和 -n 相似,只不过对于空白行不编号
-s 或 –squeeze-blank 当遇到有连续两行以上的空白行,就代换为一行的空白行
-v 或 –show-nonprinting
范例:
cat -n linuxfile1 > linuxfile2 把 linuxfile1 的档案内容加上行号后输入 linuxfile2 这个档案里
cat -b linuxfile1 linuxfile2 >> linuxfile3 把 linuxfile1 和 linuxfile2 的档案内容加上行号(空白行不加)之后将内容附加到linuxfile3 里。
范例:
把 linuxfile1 的档案内容加上行号后输入 linuxfile2 这个档案里
cat -n linuxfile1 > linuxfile2
把 linuxfile1 和 linuxfile2 的档案内容加上行号(空白行不加)之后将内容附加到 linuxfile3 里。
cat -b linuxfile1 linuxfile2 >> linuxfile3
cat /dev/null > /etc/test.txt 此为清空/etc/test.txt

cat,英文全拼:concatenate,用于连接文件并打印到标准输出设备上。
使用权限
所有使用者
语法格式
cat [-AbeEnstTuv] [--help] [--version] fileName
参数说明
-n或--number:由1开始对所有输出的行数编号;
-b或--number-nonblank:和-n相似,只不过对于空白行不编号;
-s或--squeeze-blank:当遇到有连续两行以上的空白行,就代换为一行的空白行;
-v或--show-nonprinting:使用^和M-符号,除了LFD和TAB之外;
-E或--show-ends:在每行结束出显示$;
-T或--show-tabs:将TAB字符显示为^I;
-A,--show-all:等价于-vET;
-e:等价于"-vE"选项;
-t:等价于"-vT"选项。

扩展阅读:linux cat命令详解 ... linux cat 最后几行 ... linux的find命令用法 ... linux cat怎么退出 ... linux cat命令的用法 ... linux中grep命令详解 ... linux echo命令详解 ... linux diff命令详解 ... linux cat命令退出 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网