DEV Community

Cover image for Living in the Shell #21; head (Display File Content From Beginning)
Babak K. Shandiz
Babak K. Shandiz

Posted on • Originally published at babakks.github.io on

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

head 📜

Displays file content from beginning.

Print first N lines of a file -n

head -n 5 ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

Print all but N last lines -n -N

tail -n -3 ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

Print first N bytes of a file -c

head -c 1k ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

Prints first 1k of file binary content.

Print all but N last bytes -c -N

tail -c -1k ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
sso profile image
Sall

Nice, simple and useful 👍
If you ever start a "Living in a Z Shell" and will look for ideas let me know 😃
Also I am looking for collaborators to make the project and it's wiki new user friendly.