2025-03-14 21:59:59 -06:00
|
|
|
# head
|
|
|
|
|
|
|
|
|
|
> Output the first part of files.
|
|
|
|
|
> More information: <https://keith.github.io/xcode-man-pages/head.1.html>.
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Output the first 10 lines of a file:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`head {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Output the first 5 lines of multiple files:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`head {{[-5|--lines 5]}} {{path/to/file1 path/to/file2 ...}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Output the first `n` lines of a file:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`head {{[-n|--lines]}} {{n}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Output the first `n` bytes of a file:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`head {{[-c|--bytes]}} {{n}} {{path/to/file}}`
|