zoukankan      html  css  js  c++  java
  • tail 显示文件内容尾部

    1.命令功能

    tail默认显示文件内容尾部10行。

    2.语法格式

    tail  option  file

    参数说明

    参数

    参数说明

    -n

    显示指定行数

    -f

    实时输出文件变化后追加的数据

    -s

    监视文件变化的间隔秒数

    -v

    总是显示包含指定文件名的文件头

    3.使用范例

    范例1  tail 默认显示后10行

    [root@localhost chu]# tail passwd
    
    nobody:x:99:99:Nobody:/:/sbin/nologin
    
    vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
    
    saslauth:x:499:76:Saslauthd user:/var/empty/saslauth:/sbin/nologin
    
    postfix:x:89:89::/var/spool/postfix:/sbin/nologin
    
    sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
    
    ntp:x:38:38::/etc/ntp:/sbin/nologin
    
    cxf:x:500:500::/home/cxf:/bin/bash
    
    ok:x:501:501::/home/ok:/bin/bash
    
    joe:x:502:502::/home/joe:/bin/bash
    
    chu:x:503:503::/home/chu:/bin/bash

    范例2  实时监控文件变化追加的内容

    [root@localhost chu]# tail -f /var/log/messages
    
    Apr 23 14:47:22 localhost sshd[1309]: Server listening on :: port 22.
    
    Apr 23 14:47:22 localhost xinetd[1320]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
    
    Apr 23 14:47:22 localhost xinetd[1320]: Started working: 1 available service
    
    Apr 23 14:47:24 localhost sshd[1436]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
    
    Apr 23 14:47:24 localhost sshd[1436]: error: Bind to port 22 on :: failed: Address already in use.

    范例3  显示文件头部

    [root@localhost chu]# tail -vf /var/log/messages
    
    ==> /var/log/messages <==
    
    Apr 23 14:47:22 localhost sshd[1309]: Server listening on :: port 22.
    
    Apr 23 14:47:22 localhost xinetd[1320]: xinetd Version 2.3.14 started with libwrap loadavg labeled-networking options compiled in.
    
    Apr 23 14:47:22 localhost xinetd[1320]: Started working: 1 available service
    
    Apr 23 14:47:24 localhost sshd[1436]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
    
    Apr 23 14:47:24 localhost sshd[1436]: error: Bind to port 22 on :: failed: Address already in use.
  • 相关阅读:
    Dubbo支持的协议的详解
    db2 SQL6036N解决办法
    9-5 HTTP注解演示及注意事项讲解
    9-4 Feign之HTTP注解介绍
    9-3 Feign演示及Feign注解解析
    9-2 Feign环境准备
    9-1 Feign自我介绍
    8-30 Hystrix章节总结
    8-29 实战技巧:如何设置线程池
    8-28 Hystrix监控讲解与演示
  • 原文地址:https://www.cnblogs.com/joechu/p/8947454.html
Copyright © 2011-2022 走看看