head命令用法#
head打印文件的第一部分(默认为10行);如果没有给出文件,或当给定为 - 的文件时,它会从标准输入读取。
$ head hugo.toml
baseURL = 'https://nodeb.net/'
title = 'NodeB'
theme = 'nodeb'
paginate = 5
# 语言配置 - 使用新方式避免弃用警告
defaultContentLanguage = 'zh-cn'
[languages]
[languages.zh-cn]-c [-]num 打印num字节的内容,num为数字,如果前面加-则打印文件最后除了num字节的所有内容。
num可以加以下单位
‘b’ => 512 ("blocks")
‘KB’ => 1000 (KiloBytes)
‘K’ => 1024 (KibiBytes)
‘MB’ => 1000*1000 (MegaBytes)
‘M’ => 1024*1024 (MebiBytes)
‘GB’ => 1000*1000*1000 (GigaBytes)
‘G’ => 1024*1024*1024 (GibiBytes)$ head -c 60 hugo.toml
baseURL = 'https://nodeb.net/'
title = 'NodeB'
theme = 'no
$ head -c -1k hugo.toml
baseURL = 'https://nodeb.net/'
title = 'NodeB'
theme = 'nodeb'
paginate = 5
# 语言配置 - 使用新方式避免弃用警告
defaultContentLanguage = 'zh-cn'
[languages]
[languages.zh-cn]
label = "中文"
locale = 'z-n [-]num 输出num行内容,如果前面加了-则标识输出文件末尾num行以外的内容。
$ head -n 5 hugo.toml
baseURL = 'https://nodeb.net/'
title = 'NodeB'
theme = 'nodeb'
paginate = 5
$ head -n -50 hugo.toml
baseURL = 'https://nodeb.net/'
title = 'NodeB'
theme = 'nodeb'
paginate = 5
# 语言配置 - 使用新方式避免弃用警告
defaultContentLanguage = 'zh-cn'
[languages]
[languages.zh-cn]
label = "中文"
locale = 'zh-cn' # 替代 languageCode
direction = 'ltr' # 从左到右
weight = 1
title = 'NodeB'