Linux常用基本命令(more)

时间:2021-01-17 14:50:42

more命令

作用:相比cat一次性显示文件内容,more用于分页显示内容,less比more更强大,大多数的参数类似

more [option] [file]

-num : 每页显示num行

+num: 指定从num行开始

-s: 把连续的多个空行显示为一行

ghostwu@dev:~/linux/more$ cat -n ghostwu.txt
this is ghostwu how are you file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you and you?
ghostwu@dev:~/linux/more$ more -s ghostwu.txt
this is ghostwu how are you file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you
file thank you and you?
ghostwu@dev:~/linux/more$
ghostwu@dev:~/shell_script$ more - install.sh
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF- is64bit=`getconf LONG_BIT`
if [ "$is64bit" = '' ];then
echo '=================================================';
echo -e "\033[31m BT-Panel Incompatible 32 bit OS. \033[0m";
exit;
--More--(%)
ghostwu@dev:~/linux/more$ ls / | more -
bin
boot
cdrom
dev
etc
home
initrd.img
lib
lib64
lost+found
--More--

交互子命令

空格键:向下滚动一屏

b:返回上一屏

f:也可以向下滚动一屏

/查找文本

:f 输出文件名和当前的行数

q:退出more命令