headコマンド~先頭部分を表示します~【Linuxコマンド集】

ファイルの先頭部分を表示します。オプションを指定していない場合は、先頭から10行目までを表示します。
headコマンドの基本
head [オプション] [ファイル名]

headの主なオプション
オプション | 説明 |
---|---|
-n 行数 | 先頭から指定された行数分だけ表示する |
-行数 | 先頭から指定された行数分だけ表示する |
-c バイト数 | 出力するバイト数を指定する |
先頭から指定された行数分だけ表示する
$ head -n 3 0000.txt

出力するバイト数を指定する
$ head -c 10 0000.txt

-
前の記事
odコマンド~ファイル内を確認する~【Linuxコマンド集】 2021.07.20
-
次の記事
tailコマンド~末尾部分を表示します~【Linuxコマンド集】 2021.07.27