Purpose
The tail command is mainly used to take out the last few lines
Full name
The full name of the tail command is tail (tail)
Parameter
-n: followed by The numbers represent the meaning of displaying a few lines
-f: loop reading
-q: do not display processing information
-v: display detailed processing information
Case
Case 1: Display the last 5 lines of the file
[root@bigdata ~]# tail -5 /etc/man_db.conf
#
#————————————————- ——–
# Flags.
# NOCACHE keeps man from creating cat pages.
#NOCACHE
Case 2: Cycle through file content
[root@bigdata /]# ping localhost >test.txt &
[4] 9944
[root@bigdata /]# tail -f test.txt
64 bytes from localhost (127.0.0.1): icmp_seq=1791 ttl=64 time=0.112 ms
64 bytes from localhost (127.0.0.1): icmp_seq=1792 ttl=64 time=0.161 ms
bytes from localhost (127.0.0.1): icmp_seq=1793 ttl=64 time=0.166 ms
64 bytes from localhost (127.0.0.1): icmp_seq=1794 ttl=64 time=0.133 ms
….
Want to end press Just CTRL+C
Case 3: Display the file from line 5
[root@bigdata /]# tail -n +5 /etc/man_db.conf
# their PATH environment variable. For details see the manpath(5) man page.
#
# Lines beginning with `#‘ are comments and are ignored. Any combination of
# tabs or spaces may be used as `whitespace` separators.
#
# There are three mappings allowed in this file:
# ————————————————– ——-
# MANDATORY_MANPATH manpath_element
# MANPATH_MAP path_element manpath_element
# MANDB_MAP global_manpath [relative_catpath]
#————————————————- ——–
……
【Linux】tail command