[ftt@localhost ~]$
file *
公共: directory
模板: directory
视频: directory
图片: directory
文档: directory
下载: directory
音乐: directory
桌面: directory
[ftt@localhost 文档]$ cat test.txt //cat是concatenate(拼接)的缩写,用来显示文件内容
[ftt@localhost 文档]$ cat test1
ABCD
[ftt@localhost 文档]$ cat test2
EFG
[ftt@localhost 文档]$ cat test1 test2 //cat可以显示多个文件
ABCD
EFG
[ftt@localhost 文档]$ cat test1 test2 > test3
//cat 可以把多个文件显示到stdout,并把连接成的内容保存到另一个文件
[ftt@localhost 文档]$ cat test3
ABCD
EFG
[ftt@localhost 文档]$ cat -n test1 test2 >>test3 //n(number)生成行号
[ftt@localhost 文档]$ cat test3
ABCD
EFG
1 ABCD
2 EFG
3
[ftt@localhost 文档]$ ls --color | less //less用来显示多页内容
less 显示内容后,长按v,可对文件进行编辑
另一种方法是在less之前,输入export EDITOR=vim
[ftt@localhost 文档]$ head test1 //显示单个文件的前10行
ABCD
[ftt@localhost 文档]$ head test1 test2 //显示多个文件的前10行
==> test1 <==
ABCD
==> test2 <==
EFG
[ftt@localhost 文档]$ head -n 2 test3 //head -n 后面加数字显示一个或多个文件前n行
AB
CD
EFG
tail与head相反,显示文件后面的内容,tail 一个或多个文件名;tail -n 一个或多个文件名
[ftt@localhost 文档]$ head -c 7 test3 //显示文件前容量为byte/KB/MB/GB/TB/PB/EB的内容
ABCD
EF
tail -f//可以查看一个或多个文件中经常更新的最后几行内容
公共: directory
模板: directory
视频: directory
图片: directory
文档: directory
下载: directory
音乐: directory
桌面: directory
[ftt@localhost 文档]$ cat test.txt //cat是concatenate(拼接)的缩写,用来显示文件内容
[ftt@localhost 文档]$ cat test1
ABCD
[ftt@localhost 文档]$ cat test2
EFG
[ftt@localhost 文档]$ cat test1 test2 //cat可以显示多个文件
ABCD
EFG
[ftt@localhost 文档]$ cat test1 test2 > test3
//cat 可以把多个文件显示到stdout,并把连接成的内容保存到另一个文件
[ftt@localhost 文档]$ cat test3
ABCD
EFG
[ftt@localhost 文档]$ cat -n test1 test2 >>test3 //n(number)生成行号
[ftt@localhost 文档]$ cat test3
ABCD
EFG
1 ABCD
2 EFG
3
[ftt@localhost 文档]$ ls --color | less //less用来显示多页内容
less 显示内容后,长按v,可对文件进行编辑
另一种方法是在less之前,输入export EDITOR=vim
[ftt@localhost 文档]$ head test1 //显示单个文件的前10行
ABCD
[ftt@localhost 文档]$ head test1 test2 //显示多个文件的前10行
==> test1 <==
ABCD
==> test2 <==
EFG
[ftt@localhost 文档]$ head -n 2 test3 //head -n 后面加数字显示一个或多个文件前n行
AB
CD
EFG
tail与head相反,显示文件后面的内容,tail 一个或多个文件名;tail -n 一个或多个文件名
[ftt@localhost 文档]$ head -c 7 test3 //显示文件前容量为byte/KB/MB/GB/TB/PB/EB的内容
ABCD
EF
tail -f//可以查看一个或多个文件中经常更新的最后几行内容