Linux命令-tail

命令分析

tail命令可用于查看文件的内容,通常用来查看日志,加上-f参数就可以查看最新的日志并且不断刷新。

命令格式

tail [参数] [文件]

参数

  • -f 循环读取
  • -q 不显示处理信息
  • -v 显示详细的处理信息
  • -c<数目> 显示的字节数
  • -n<行数> 显示文件的尾部 n 行内容
  • --pid=PID 与-f合用,表示在进程ID,PID死掉之后结束
  • -q, --quiet, --silent 从不输出给出文件名的首部
  • -s, --sleep-interval=S 与-f合用,表示在每次反复的间隔休眠S秒

例子

实时查看jenkins的日志

# tail -f /var/log/jenkins/jenkins.log
2020-06-08 00:34:16.777+0000 [id=27] INFO o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@67401a8e]: org.springframework.beans.factory.support.DefaultListableBeanFactory@4eb5cf66
2020-06-08 00:34:16.779+0000 [id=27] INFO o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4eb5cf66: defining beans [filter,legacy]; root of factory hierarchy
2020-06-08 00:34:17.027+0000 [id=27] INFO jenkins.InitReactorRunner$1#onAttained: Completed initialization
2020-06-08 00:34:17.111+0000 [id=20] INFO hudson.WebAppMain$3#run: Jenkins is fully up and running
2020-06-08 00:34:51.566+0000 [id=41] INFO h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
2020-06-08 00:34:52.639+0000 [id=41] INFO h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.plugins.gradle.GradleInstaller
2020-06-08 00:34:53.453+0000 [id=41] INFO h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tasks.Ant.AntInstaller
2020-06-08 00:34:55.783+0000 [id=41] INFO h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tools.JDKInstaller
2020-06-08 00:34:55.783+0000 [id=41] INFO hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1
2020-06-08 00:34:55.787+0000 [id=41] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 42,704 ms

Linux命令-tail命令的更多相关文章

  1. Linux下tail命令的使用方法

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

  2. head命令 tail命令

    head命令 head命令用于显示文件的开头的内容.在默认情况下,head命令显示文件的头10行内容. -n<数字>:指定显示头部内容的行数: -c<字符数>:指定显示头部内容 ...

  3. 【linux】tail 命令详解

    转自:https://www.cnblogs.com/fps2tao/p/7698224.html Linux命令:显示文件结尾 Head/Tail head 与 tail 就像它的名字一样的浅显易懂 ...

  4. 菜鸟学Linux命令:tail命令 查看日志

    tail 命令用于显示指定文件末尾内容,不指定文件时,作为输入信息进行处理. tail命令常用来查看日志文件.使用tail命令的-f选项可以方便的查阅正在改变的日志文件,tail -f filenam ...

  5. Linux下tail命令

    简述 tail命令从指定点开始将文件写到标准输出,使用tail命令的“-f”选项可以方便的查阅正在改变的日志文件,“tail -f filename”会把filename里最尾部的内容显示在屏幕上,并 ...

  6. Linux head/tail命令详解

    head命令用于显示文件的开头的内容.在默认情况下,head命令显示文件的头10行内容. tail命令用于显示文件的结尾的内容.在默认情况下,taild命令显示文件的后10行内容. head常见命令参 ...

  7. Linux 下 tail 命令

    简述 tail命令从指定点开始将文件写到标准输出,使用tail命令的“-f”选项可以方便的查阅正在改变的日志文件,“tail -f filename”会把filename里最尾部的内容显示在屏幕上,并 ...

  8. 【Linux】tail命令

    用途 tail命令主要用于取出后边几行 全称 tail命令的全称即为tail(尾巴) 参数 -n :后边接数字,代表显示几行的意思 -f :循环读取 -q :不显示处理信息 -v :显示详细的处理信息 ...

  9. Linux的tail命令查看文件

    小文件一般用cat  查看,但是如果文件内容过多,用cat就不合适了 可以用tail命令 # 默认显示文件最后十行 tail a.txt # 监视文件的尾部内容,默认十行, 可以-n 20显示20行 ...

  10. Linux常用命令 - tail命令详解

    21篇测试必备的Linux常用命令,每天敲一篇,每次敲三遍,每月一循环,全都可记住!! https://www.cnblogs.com/poloyy/category/1672457.html 实时刷 ...

随机推荐

  1. django读取数据库导出excel

    路由 path(r'^export/xls/$', views.export_excel, name='export_excel'), 函数 import xlwt from django.http ...

  2. Python 3.12 抢先看——关于 f-string 的改动

    Python 3.12 抢先看--关于 f-string 的改动 哈喽大家好,我是咸鱼 相信小伙伴们对 python 中的 f-string 都不陌生 f-string 是格式化字符串的缩写,是以小写 ...

  3. 【3rd Party】nlohmann json 基础用法

    参考链接:Here 什么是nlohman json ? nlohman json GitHub - nlohmann/json: JSON for Modern C++ 是一个为现代C++(C++11 ...

  4. Codeforce Problem 711A - Bus to Udayland (正则表达式)

    https://codeforces.com/problemset/problem/711/A 正则表达式基本应用 #include<bits/stdc++.h> using namesp ...

  5. 【每日一题】41. 德玛西亚万岁 (状态压缩DP)

    补题链接:Here 经典状压DP问题 坑点,注意多组输入... const int N = 16, mod = 100000000; int f[N][1 << N]; int a[N]; ...

  6. 悟空活动中台 - 基于 WebP 的图片高性能加载方案

    本文首发于 vivo互联网技术 微信公众号 链接: https://mp.weixin.qq.com/s/rSpWorfNTajtqq_pd7H-nw作者:悟空中台研发团队 一.背景 移动端网页的加载 ...

  7. CompletableFuture 使用详解

    CompletableFuture 使用详解 1. runAsync 和 supplyAsync方法 CompletableFuture 提供了四个静态方法来创建一个异步操作. public stat ...

  8. 十、docker镜像的分层

    系列导航 一.docker入门(概念) 二.docker的安装和镜像管理 三.docker容器的常用命令 四.容器的网络访问 五.容器端口转发 六.docker数据卷 七.手动制作docker镜像 八 ...

  9. <vue初体验> 基础知识 1、vue的引入和使用体验

    系列导航 <vue初体验> 一. vue的引入和使用体验 <vue初体验> 二. vue的列表展示 <vue初体验> 三. vue的计数器 <vue初体验&g ...

  10. C语言常用字符串操作函数整理(详细全面)

    目录 字符串相关 1.char *gets(char *s); #include<stdio.h> 2.char *fgets(char *s, intsize, FILE *stream ...