Skip to Content
gnux

-c, --bytes

Print the first NUM bytes of each file; with a leading '-', print all but the last NUM bytes of each file.

An option of headx.

Usage

headx -c [-]NUM [FILE]...
headx --bytes=[-]NUM [FILE]...

Details

ShortLongValueDefaultMeaning
-c--bytes[-]NUMprint the first NUM bytes of each file; with a leading '-', print all but the last NUM bytes of each file

Examples

headx -c 1K image.png > start.bin

Check a file's magic number from its first bytes

headx -c 4 image.png | catx -v

Copy the first megabyte (10^6 bytes) of a large file

headx -c 1MB disk.img > sample.img

Strip the final byte, such as a trailing newline

headx -c -1 version.txt

Help in the terminal

gnux help headx --bytes

On this page