Babak K. Shandiz
Babak K. Shandiz's Blog

Babak K. Shandiz's Blog

Living in the Shell #21; head (Display File Content From Beginning)

Living in the Shell #21; head (Display File Content From Beginning)

Babak K. Shandiz's photo
Babak K. Shandiz
ยทDec 21, 2021ยท

1 min read

head ๐Ÿ“œ

Displays file content from beginning.

Print first N lines of a file -n

head -n 5 ~/.bashrc

Print all but N last lines -n -N

tail -n -3 ~/.bashrc

Print first N bytes of a file -c

head -c 1k ~/.bashrc

Prints first 1k of file binary content.

Print all but N last bytes -c -N

tail -c -1k ~/.bashrc
ย 
Share this