返回首页   进站必读

1.11 cat/more/less


1.11.1 cat

cat filename
cat用来查看文本文件中的内容。

$ls
main.c  Makefile
$cat main.c
 the content of main.c 
若cat后不加任何文件名,则cat进程就会一起运行,不能自行退出,这时按下Ctrl + Z即可结束该进程。
$ cat
 
^C
$

1.11.2 more

more filename
more与cat的作用差不多,只是当文件内容多于一屏时,按下空格可以滚到下一屏继续阅读,但是不可以回退。

$ more main.c

content of main.c
...
press space to continue

1.11.3 less

less filename
less的功能比more更强大,当文件内容多于一屏时,按j可以向下滚动,按k可以向上滚动。

$ less main.c

content of main.c 
...
press j to down
press k to up