Linux简单命令集——head

NAME

   head - output the first part of files 输出文件的第一部分

SYNOPSIS

   head [OPTION]... [FILE]...
   head [选项]... [文件]...
   head命令在屏幕上显示指定文件file的开头若干行,行数由参数值来确定。显示行数的默认值是10。
  -c, --bytes=[-]NUM       print the first NUM bytes of each file;
                           with the leading '-', print all but the last NUM bytes 
                           of each file
                           显示每个文件的前N字节。若数字NUM前面带有“-”,则分别显示每个
                           文件除最后NUM字节以外的所有内容。
                             
  -n, --lines=[-]NUM       print the first NUM lines instead of the first 10;
                           with the leading '-', print all but the last NUM lines 
                           of each file
                           显示指定文件的前NUM行,而不是默认的10行。若数字NUM前面带有“-”,
                           则分别显示每个文件除最后N行以外的所有内容。
  
  -q, --quiet, --silent	   不显示包含给定文件名的文件头(标题)
  
  -v, --verbose		       总是显示包含给定文件名的文件头(标题)

  -z, --zero-terminated    以 NUL 字符而非换行符作为行尾分隔符

示例

$ head -5 mfile (显示文件mfile的前五行)
$ head -v mfile (显示文件mfile的内容,并且给出文件名标题)
$ head -q mfile (显示文件mfile的内容,但不列出文件名标题)

猜你喜欢

转载自blog.csdn.net/Jormungand_V/article/details/108585177
今日推荐