Chinaunix首页 | 论坛 | 博客
  • 博客访问: 132498
  • 博文数量: 28
  • 博客积分: 527
  • 博客等级: 中士
  • 技术积分: 367
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-09 17:05
个人简介

运维开发工程师。致力于网络,WEB应用服务,Linux系统运维。方向:操作系统,监控,自动化

文章分类

全部博文(28)

文章存档

2013年(12)

2012年(16)

分类: LINUX

2012-12-30 16:30:53

head用法
command
查看文件的开头N行,支持多文件,多文件时会有标题输出
  1. head -n N file

head的多种实现
  1. $ head -N file #N是用户指定的行数
  2. $ awk 'FNR <= N' file
  3. $ sed Nq file

-------------------------------------------------------------------------------
tail用法
command
查看文件的结尾N行,支持多文件,多文件时会有标题输出
  1. tail -n N file

跟踪日志输出
  1. $ tail -f logfile #此法持续监控某个文件的输出
  2. $ less 后加F #等价形式
  3. # man less : F
  4. Scroll forward, and keep trying to read when the end of file is reached. Normally this command would be used when already at the end of the file. It is a way to monitor the tail of a file which is growing while it is being viewed. (The behavior is similar to the "tail -f" command.)

阅读(1391) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~