tongxiaoming520 发表于 2013-1-31 02:30:05

linux commands


最基本的是cat、more和less。
1. 如果你只想看文件的前5行,可以使用head命令,如:
head -5  /etc/passwd

2. 如果你想查看文件的后10行,可以使用tail命令,如:
tail -10  /etc/passwd 或 tail -n 10  /etc/passwd
tail -f  /var/log/messages
参数-f使tail不停地去读最新的内容,这样有实时监视的效果 用Ctrl+c来终止

3. 查看文件中间一段,你可以使用sed命令,如:
sed -n '5,10p' /etc/passwd
这样你就可以只查看文件的第5行到第10行。 
<div style="padding: 0px; margin: 0px; border-width: 0px; font-weight: inherit; font-style: inherit; font-size: 11pt; font-family: inherit; vertical-align: baseline; line-height: 1.5em;">
页: [1]
查看完整版本: linux commands