There are several commands and programs provided by Linux for viewing the contents of file. Working with files is one of the daunting task, most of the computer users be it newbie, regular user, advanced user, developer, admin, etc performs. Working with files effectively and efficiently is an art.
Today, in this article we will be discussing the most popular commands called head, tail and cat, most of us already aware of such commands, but very few of us implement it when needed.
1. head Command
The head command reads the first ten lines of a any given file name. The basic syntax of head command is:
For example, the following command will display the first ten lines of the file named ‘/etc/passwd‘.
If more than one file is given, head will show the first ten lines of each file separately. For example, the following command will show ten lines of each file.
If it is desired to retrieve more number of lines than the default ten, then ‘-n‘ option is used along with an integer telling the number of lines to be retrieved. For example, the following command will display first 5 lines from the file ‘/var/log/yum.log‘ file.
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
► Read more: http://adf.ly/1nBVaL
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
No comments:
Post a Comment