文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > 我使用过的linux命令 - head
侵权投诉

我使用过的linux命令 - head

head 是显示一个文件的内容的前多少行;

用法比较简单;


head -n 行数值 文件名;

比如我们显示/etc/profile的前10行内容,应该是:


[root@localhost ~]# head -n 10 /etc/profile


默认10行

参数:
-c, --bytes = N
输出每个文件的前N个字节
如果-N,输出每个文件的最后N个字节
-n, --lines = N
输出每个文件的前N行
如果-N,输出每个文件的最后N行


NAME
tail - output the last part of files

SYNOPSIS
tail [OPTION]... [FILE]...

DESCRIPTION
Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a
header giving the file name. With no FILE, or when FILE is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.

--retry
keep trying to open a file even if it is inaccessible when tail starts or if it becomes inaccessi-
ble later; useful when following by name, i.e., with --follow=name

-c, --bytes=N
output the last N bytes; alternatively, use +N to output bytes starting with the Nth of each file

-f, --follow[={name|descriptor}]
output appended data as the file grows; -f, --follow, and --follow=descriptor are equivalent

-F same as --follow=name --retry

-n, --lines=N
output the last N lines, instead of the last 10; or use +N to output lines starting with the Nth

--max-unchanged-stats=N
with --follow=name, reopen a FILE which has not changed size after N (default 5) iterations to see
if it has been unlinked or renamed (this is the usual case of rotated log files)

--pid=PID
with -f, terminate after process ID, PID dies

-q, --quiet, --silent
never output headers giving file names

-s, --sleep-interval=S
with -f, sleep for approximately S seconds (default 1.0) between iterations.

-v, --verbose
always output headers giving file names

--help display this help and exit

--version
output version information and exit

If the first character of N (the number of bytes or lines) is a '+', print beginning with the Nth item
from the start of each file, otherwise, print the last N items in the file. N may have a multiplier suf-
fix: b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024, GB 1000*1000*1000, G 1024*1024*1024, and so on
for T, P, E, Z, Y.

With --follow (-f), tail defaults to following the file descriptor, which means that even if a tail'ed
file is renamed, tail will continue to track its end. This default behavior is not desirable when you
really want to track the actual name of the file, not the file descriptor (e.g., log rotation).

第1页

你可能喜欢

  • linux操作系统命令
  • Linux系统命令使用详解
  • linux系统常用命令
  • Excel使用技巧大全(超
  • 使用技巧

热门文档

相关文档

  • linux下head命令整理

    Linux 下 head 命令整理 主要功能:显示每个指定文件的前 10 行到标准输出。 ... 我使用过的linux命令 - ... 暂无评价 2页 免费 linux下的mail命令 6页 1...

  • 每天一个linux命令(14):head 命令

    每天一个linux命令(14):head 命令_计算机软件及应用_IT/计算机_专业资料。每天一个 linux 命令(14):head 命令 head 与 tail 就像它的名字一样的浅显易懂, ...

  • 全面的linux命令大全

    全面的linux命令大全_计算机软件及应用_IT/计算机_专业资料。选填,简要介绍文档...此项命令是: head <filename> head 是一个有用的命令,但是由于它只限于文件...

  • 常用LINUX的基本命令

    查看文件的开始或最后部分内容 (head 和 tail )在 linux 中,显示文件开始和尾部内容的命令是 head 和 tail。 我们可以使用 head 命令输出文件制定前面行数的内容...

  • Linux常用命令,史上最全的linux命令

    使用不 便 bash:Bourne Again Shell,Linux系统默认...重复执行以前执行过的命令,而无须重新键入该命令。 ...文件处理指令:head 指令名称:head 指令所在路径:/ ...

  • linux下查看日志基本命令

    3.2 less的动作命令; 4、head 工具,显示文件内容的前几行; 5、tail 工具...应该说是linux正统查看文件内容的工具,功能极其强大;您是初学者,我建议您用less...

  • linux系统命令

    系统# uname -a # head -n 1 /etc/issue # cat /proc/cpuinfo # host...我们可以用 rpm-ivh Linux-1.4-6.i368.rpm 命令安装此软件。在安装过程中,...

  • Linux常用命令使用方法大全

    Linux常用命令使用方法大全_IT/计算机_专业资料。1...按 ctrl+d 保存 cat 1.c more 1.c head -n ...用户用过的命令和执行历史执行的命令 history 显示...

  • Linux系统常用命令快速入门

    Linux系统常用命令快 速入门 —————菜鸟了解 目录 Linux系统常用命令快速入门...此项命令是: head <filename> head 是一个有用的命令,但是由于它只限于文件...

  • linux常用命令及经典用法

    学习linux要先会操作此系统,你连用都不会用,何谈...不多解释,自己去体会吧,下面来讲命令: 1、whereis...立即重启 16、head (1)功能描述:输出文件内容前面...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email