Concatenate and display file contents连接并显示文件内容
The cat command (short for "concatenate") is one of the most frequently used commands in Unix/Linux. It reads files sequentially, writing them to standard output. You can use it to view file contents, combine files, and create new files.
cat命令("concatenate"的缩写)是Unix/Linux中最常用的命令之一。它按顺序读取文件并将它们写入标准输出。你可以用它来查看文件内容、组合文件和创建新文件。
| Option选项 | Full Name完整名称 | Description描述 | Example示例 |
|---|---|---|---|
-n |
number行号 | Number all output lines对所有输出行编号 | cat -n file.txt |
-b |
number-nonblank非空行号 | Number non-blank lines对非空行编号 | cat -b file.txt |
-s |
squeeze-blank压缩空行 | Suppress repeated empty lines压缩重复的空行 | cat -s file.txt |
-v |
show-nonprinting显示非打印字符 | Show non-printing characters显示非打印字符 | cat -v file.txt |
-E |
show-ends显示行尾 | Display $ at end of each line在每行末尾显示$ | cat -E file.txt |
-T |
show-tabs显示制表符 | Display TAB characters as ^I将制表符显示为^I | cat -T file.txt |
-A |
show-all显示全部 | Equivalent to -vET等同于-vET | cat -A file.txt |
🐱 "cat" = concatenate - Think of a cat linking multiple files together like a chain!
🐱 "cat" = concatenate(连接) - 想象一只猫像链条一样把多个文件连在一起!
🔢 -n = Number - Add line numbers to your output
🔢 -n = Number(数字) - 为输出添加行号
📦 -s = Squeeze - Squeeze multiple blank lines into one
📦 -s = Squeeze(挤压) - 将多个空行压缩成一个