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.
  • 相关阅读:
    C#使用Task创建任务
    Java编程思想学习(二)一切都是对象
    Java编程思想学习(一)对象导论中多态的理解
    【源码】sql__备份数据库1__bak数据库__存储过程
    【源码】自己写的Msg
    【情感】女人永远是期望男人主动的
    sql函数 手机品牌
    【源码】继承pagebase 权限判断
    【源码】Sql Server 2005 如何自动备份数据库
    sql 将smslog拆分3天3月内,3月外表
  • 原文地址:https://www.cnblogs.com/joechu/p/8947454.html
Copyright © 2011-2022 走看看