1024programmer News [Linux] tail command

[Linux] tail command

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


This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/linux-tail-command/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索