How to Use the tail command in RHEL5? -- Linux general technology-Linux technology and application information. For details, refer to the following section. In this case, I searched the internet for how to use the tail Command, as shown below:
Tail
Function: displays the last several rows of a specified file. Syntax: the options in the tail [+/-num] [parameter] File's tail command are described as follows: + num is displayed after row num. ? Num is displayed starting from the num row at the end of the file. If the num parameter is omitted, the default value is 10. L count the unit of text behavior num. And Parameter options + num or-
Function: displays the last several rows of a specified file.
Syntax: tail [+/-num] [parameter] File
The meanings of the options in the tail command are as follows:
+ Num is displayed after row num.
-Num is displayed starting from the num row at the end of the file. If the num parameter is omitted, the default value is 10.
L count the unit of text behavior num. When used with Parameter options + num or-num options, num indicates the number of lines of text lines to be displayed.
C is measured in bytes as num. And Parameter options + num or-[...]
The problem is that the + code function is always unsuccessful. I used the command: tail + 2/etc/passwd to view the/etc/passwd file, from the second line to the end.
[Root @ s1 ~] # Tail + 2/etc/passwd
Tail: cannot open "+ 2" to read data: No file or directory
==>/Etc/passwd <=
Nfsnobody: x: 65534: 65534: Anonymous NFS User:/var/lib/nfs:/sbin/nologin
Sshd: x: 74: 74: Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
Pcap: x: 77: 77:/var/arpwatch:/sbin/nologin
Ntp: x: 38: 38:/etc/ntp:/sbin/nologin
Haldaemon: x: 68: 68: HAL daemon: // sbin/nologin
Xfs: x: 43: 43: X Font Server:/etc/X11/fs:/sbin/nologin
EM: x: 42: 42:/var/EM:/sbin/nologin
Sabayon: x: 86: 86: Sabayon user:/home/sabayon:/sbin/nologin
Mate: x: 500: 500:/home/mate:/bin/bash
Qqq: x: 501: 503:/home/qqq:/bin/bash
Obviously, only the last 10 lines are displayed. He treats + 2 as not a command option but a file.
Now I want to print the content after line n in the/etc/passwd file. What should I do?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service