Linux查看内容命令[持续添加]

1.cat
$cat -n 显示行号
$cat > test.sh 创建新文件[CTRL]+d结束
类似dos的C:\>copy con test.bat [CTRL]+z结束。

2.less/more
less允许上下箭头回滚,more不允许。

3.head 显示前n行
$head -5 /etc/passwd

4.tail 显示最后几行
$tail -10 /etc/passwd
用于实时监测日志:tail -f /var/log/messages

5.sed 指定行以及更多正则匹配功能
$sed -n '5,10p' /etc/passwd

[待添加...]

组合的命令:

$find . -name "*.txt" | grep hello | wc -l

原文地址:https://www.cnblogs.com/nonlyli/p/1519529.html