cmdxray / commands / head

What does head do?

print the first part of files.

▸ Explain your own head command →

head examples, explained

$ head -n 20 file.txt

  • headprint the first part of files
  • -nprint the first N lines
  • 20value for -n
  • file.txtan argument passed to the command

$ head -c 100 file.bin

  • headprint the first part of files
  • -cprint the first N bytes
  • 100value for -c
  • file.binan argument passed to the command

head flags & options

-nprint the first N lines
-cprint the first N bytes

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.