一、Liunx系统下的一般命令格式。
命令——实际上就是在Liunx终端中,在命令行中输入的内容。
Liunx中一个命令的完整格式为:
#指令主体(空格) [选项](空格) [操作对象]
指令主体——就是初学时候需要记住的,带有功能性的东西。如:cp ,rm ,ls 等
选项——选项可以是多个的。
操作对象也可以是多个的。
二、指令less
作用:查看文件,以较少的内容进行输出,按下辅助功能键(数字+回车、空格键+上下方向键)查看更多
空格是一页一页翻
上下键是一行一行翻
1是往下1行;10是往下10行
语法:#less 需要查看的文件路径
如:使用less指令查看/home/he/1.txt
[he@localhost ~]$ less /home/he/1.txt
执行命令可以查看该文件的内容,当前为he的家目录,也可以直接用相对路径。
在退出的只需要按下q键(quit)即可(此时ctrl+c不好使)。
命令more
[he@localhost ~]$ more /etc/passwd
Linux more 命令类似 cat ,不过会以一页一页的形式显示,更方便使用者逐页阅读,而最基本的指令就是按空白键(space)就往下一页显示,按 b 键就会往回(back)一页显示,而且还有搜寻字串的功能(与 vim 相似)。
从第 20 行开始显示 testfile 之文档内容。
$ more +20 testfile (可对比查看一般命令格式)