head命令
head命令用于显示文件的开头的内容。在默认情况下,head命令显示文件的头10行内容。
语法
head (选项) (参数)
选项
-n number :指定显示头部内容的行数。
root@68fc0a9bc6dd:/home/wzm/testtail# head redis.conf -n 3
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
-c number:指定显示头部的字符数。
root@68fc0a9bc6dd:/home/wzm/testtail# head redis.conf -c 10
# Redis coroot@68fc0a9bc6dd:/home/wzm/testtail#
-q:不显示文件名
root@68fc0a9bc6dd:/home/wzm/testtail# head -n 3 -q redis.conf README.md
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
This README is just a fast *quick start* document. You can find more detailed documentation at http://redis.io.
What is Redis?
-v:总是显示文件名的头信息,默认
root@68fc0a9bc6dd:/home/wzm/testtail# head -n 3 -v redis.conf README.md
==> redis.conf <==
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
==> README.md <==
This README is just a fast *quick start* document. You can find more detailed documentation at http://redis.io.
What is Redis?
root@68fc0a9bc6dd:/home/wzm/testtail#
参数
文件列表:指定显示头部内容的文件列表。