If you only want to see the first 5 lines of the file, you can use the Head command,
such as: Head-5 passwd
If you want to view the following 10 lines of the file, you can use the tail command,
Example:
[Root@localhost software]# head-5 passwd
Root:x:0:0:root:/root:/bin/bash &http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp;bin:x:1:1:bin:/bin:/ Sbin/nologin Daemon:x:2:2:daemon:/sbin:/sbin/nologin Adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/ Lpd:/sbin/nologin
such as: TAIL-10/ETC/PASSWD
Example:
[Root@localhost software]# tail-10/etc/passwd
Abrt:x:173:173::/etc/abrt:/sbin/nologin rpcuser:x:29:29:rpc Service User:/var/lib/nfs:/sbin/nologin nfsnobody:x : 65534:65534:anonymous NFS user:/var/lib/nfs:/sbin/nologin gdm:x:42:42::/var/lib/gdm:/sbin/nologin sshd:x:74:74: privilege-separated Ssh:/var/empty/sshd:/sbin/nologin Tcpdump:x:72:72::/:/sbin/nologin sunco:x:500:501::/home/ Sunco:/bin/bash Ldap:x:55:55:ldap user:/var/lib/ldap:/sbin/nologin Mysql:x:501:502::/home/mysql:/bin/bash www:x : 502:503::/home/www:/bin/bash
Do you know how to view the middle section of a file? You can use the SED command
such as: Sed-n ' 5,10p ' passwd
This allows you to view only lines 5th through 10th of the file.
Example:
[Root@localhost software]# sed-n ' 5,10p ' passwd
Lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin Sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/ Shutdown Halt:x:7:0:halt:/sbin:/sbin/halt Mail:x:8:12:mail:/var/spool/mail:/sbin/nologin uucp:x:10:14:uucp:/var/ Spool/uucp:/sbin/nologin