Head and Tail

PREAMBLE

Tutorial expresses the author's subjective ideas and conform to AAL license.



Description

head is used to display first n lines or bytes of the file.

tail is used to display last n lines or bytes of the file



Intro

Open terminal.app and type something random, like that:

$ echo -e "siglsjgnsgnsjngsjn \

\n ksjbgkzjvbkzjbvzkj \

\nkjvbkjbvkjvbkjbvkjb \

\n kxjvbnkjxnkjxvxkjkjnzl \

\njbvjxbvkjxbvkxjvbkj > /tmp/some.text.file.txt


$ cat /tmp/random.text.file.txt



Next level

Output first 3 lines of a file

$ head -n 3 /tmp/random.text.file.txt

$ tail -n 3 /tmp/random.text.file.txt


Output first 49 bytes of a file

$ head -c 49 /tmp/random.text.file.txt

$ head -c 49 /tmp/random.text.file.txt



Last thoughts

Be shure that I will update tutorial in the future. So, stay on tune. And, in case it was useful, share please with your fellows or comment something regarded the subject.

For donations use that link

Comments