LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

head

outputs the first 10 lines of each FILE to standard output

TLDR

Display first 10 lines of a file
$ head path/to/file
copy
Display first 5 lines of a file
$ head -n 5 path/to/file
copy
Display first 100 bytes of a file
$ head -c 100 path/to/file
copy
Display all but the last 5 lines
$ head -n -5 path/to/file
copy
Display first lines of multiple files
$ head path/to/file1 path/to/file2
copy
Suppress filename headers
$ head -q path/to/file1 path/to/file2
copy

SYNOPSIS

head [OPTION]... [FILE]...

DESCRIPTION

head outputs the first 10 lines of each FILE to standard output. When processing multiple files, it precedes each with a header containing the filename. If no file is specified or when FILE is "-", it reads from standard input.

PARAMETERS

-c, --bytes=[-]NUM

Print the first NUM bytes of each file; with leading "-", print all but the last NUM bytes
-n, --lines=[-]NUM
Print the first NUM lines instead of 10; with leading "-", print all but the last NUM lines
-q, --quiet, --silent
Never print headers giving filenames
-v, --verbose
Always print headers giving filenames
-z, --zero-terminated
Use NUL as line delimiter instead of newline

INSTALL

sudo apt install coreutils
copy
sudo dnf install coreutils
copy
sudo pacman -S coreutils
copy
sudo apk add coreutils
copy
sudo zypper install coreutils
copy
brew install coreutils
copy
nix profile install nixpkgs#coreutils
copy

CAVEATS

NUM may have a multiplier suffix: b (512), kB (1000), K (1024), MB (1000*1000), M (1024*1024), and so on for G, T, P, E, Z, Y. Binary prefixes like KiB, MiB are also supported.

HISTORY

head has been part of Unix since early versions and is included in GNU coreutils.

SEE ALSO

tail(1), cat(1), less(1), more(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid