用途

tail命令主要用于取出后边几行

全称

tail命令的全称即为tail(尾巴)

参数

-n :后边接数字,代表显示几行的意思

-f :循环读取

-q :不显示处理信息

-v :显示详细的处理信息

案例

案例一:显示文件最后5行内容

[root@bigdata ~]# tail -5 /etc/man_db.conf

#

#---------------------------------------------------------

# Flags.

# NOCACHE keeps man from creating cat pages.

#NOCACHE

案例二:循环查看文件内容

[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

….

想要结束按CTRL+C即可

案例三:从第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命令的更多相关文章

  1. 【转载】linux tail命令的使用方法详解

    本文介绍Linux下tail命令的使用方法.linux tail命令用途是依照要求将指定的文件的最后部分输出到标准设备,通常是终端,通俗讲来,就是把某个档案文件的最后几行显示到终端上,假设该档案有更新 ...

  2. linux tail命令的使用方法详解(转)

    本文介绍Linux下tail命令的使用方法.linux tail命令用途是依照要求将指定的文件的最后部分输出到标准设备,通常是终端,通俗讲来,就是把某个档案文件的最后几行显示到终端上,假设该档案有更新 ...

  3. linux tail命令的使用方法详解 (转载)

    本文介绍Linux下tail命令的使用方法.linux tail命令用途是依照要求将指定的文件的最后部分输出到标准设备,通常是终端,通俗讲来,就是把某个档案文件的最后几行显示到终端上,假设该档案有更新 ...

  4. linux tail 命令详解

    linux ---tail命令 linux中tail命令---用于查看文件内容 最基本的是cat.more和less. 1. 如果你只想看文件的前5行,可以使用head命令,如: head -5 /e ...

  5. 【转】Linux tail 命令详解

    Linux tail 命令详解 http://www.2cto.com/os/201111/110143.html

  6. linux tail命令的使用方法详解

    本文介绍Linux下tail命令的使用方法. linux tail命令用途是依照要求将指定的文件的最后部分输出到标准设备,通常是终端,通俗讲来,就是把某个档案文件的最后几行显示到终端上,假设该档案有更 ...

  7. 【转】linux tail命令使用方法详解

    原文网址:http://www.111cn.net/sys/linux/46902.htm linux tail命令用途是按照要求将指定的文件的最后部分输出到标准设备,一般是终端,通俗讲来,就是把某个 ...

  8. linux tail命令及其它日志查看命令的用法

    当日志文件存储日志很大时,我们就不能用vi直接进去查看日志,需要Linux的命令去完成我们的查看任务. Log位置: /var/log/message 系统启动后的信息和错误日志,是Red Hat L ...

  9. linux tail 命令详解!Linux 文件内容查看工具介绍

    转:http://blog.csdn.net/carzyer/article/details/4759593 1.cat 显示文件连接文件内容的工具: cat 是一个文本文件查看和连接工具.查看一个文 ...

  10. Linux tail 命令

    tail 命令可用于查看文件的内容,有一个常用的参数 -f 常用于查阅正在改变的日志文件. tail -f filename 会把 filename 文件里的最尾部的内容显示在屏幕上,并且不断刷新,只 ...

随机推荐

  1. django之cookie、session和ajax

    1 Cookie cookie是什么? 保存在客户端浏览器上的键值对   {k:v} cookie依附在请求头或响应头中出现 发送请求时,会自动携带自己网站的cookie 应用: 实现登录 投票 1. ...

  2. python开发_filecmp

    filecmp模块用于比较文件及文件夹的内容,它是一个轻量级的工具,使用非常简单.python标准库还提供了difflib模块用于比较文件的内容.关于difflib模块,且听下回分解. filecmp ...

  3. April Fools Day Contest 2016 A. Da Vinci Powers

    A. Da Vinci Powers 题目连接: http://www.codeforces.com/contest/656/problem/A Description The input conta ...

  4. Google Code Jam 2010 Round 1C Problem A. Rope Intranet

    Google Code Jam 2010 Round 1C Problem A. Rope Intranet https://code.google.com/codejam/contest/61910 ...

  5. PAT甲级1089. Insert or Merge

    PAT甲级1089. Insert or Merge 题意: 根据维基百科: 插入排序迭代,消耗一个输入元素每次重复,并增加排序的输出列表.每次迭代,插入排序从输入数据中删除一个元素,在排序列表中找到 ...

  6. 擦亮自己的眼睛去看SQLServer之谈谈锁机制

    http://www.cnblogs.com/yueyue_jwfm/category/292724.html

  7. Python pass 语句

    Python pass 语句 Python pass是空语句,是为了保持程序结构的完整性. pass 不做任何事情,一般用做占位语句. Python 语言 pass 语句语法格式如下: pass 实例 ...

  8. EatCam Webcam Recorder Pro

    EatCam Webcam Recorder Pro Webcam Recorder records webcams to AVI, FLV, WMV files and watch them whe ...

  9. FIS3使用官方例子流程

    fis3 的常用例子:https://github.com/fex-team/fis3-demo git链接可在页面中获取替换下面的git链接: 例子准备: git clone https://git ...

  10. Java:终结器防卫者,顺便看一下 C# 如何做的。

    背景 多数情况我们不需要重写 finalize 方法,只有当我们需要持有未托管资源的时候才需要,而此时重写 finalize 方法,只是作为一个“安全网”,不能作为常规的资源释放模式,必须提供显式的释 ...