Commands to View File in Linux

5 Commands to View the Content of a File in Linux

Last Updated on by Prince Pudasaini

Many of the beginners of Linux still confuse about how to view a file just from terminal. Though it is not hard but it is not totally like you read the Notepad. But there is not a worrying thing to open and displaying a file in Linux operating system (OS). It is easy when you believes you as a good code enthusiastic and it is really important to you. As a beginner you might have not a idea about how to view file manager in CUI. So, Here Tech Byte is going to mentions 5 commands that let you too view the content of file from Linux Terminal.

Cat: 

It is the most common and simple command. It is also one of the most popular command to view files which is widely used. Cat can be used as the print of the file in a computer screen. It had options that’s why it is also known as the popular command.But in the cons side will be more irritating when you need to face the problem. For example when you entered a 300 lines of command then the result will be your screen fold 3000 times which is really a embarrassing things for you.

nl:

It is another most widely used command line which displays the command in the format of number bullets. But it has limited commands to get control over the numbering. It is almost similar like cat command. You can also check the main page to view more information.

Less: 

This command let’s the user to view the single page of a file at once. Your can just exit from this by passing q and it doesn’t contains lines on the display screen. In this command your terminal remains clean.

Head:

Head of another command to view text file. It appears texts in slightly different way which displays the first 10 lines of a file by default. But using a options you can change its behaviour where the main mechanism will be same.

Tail:

It is similar command in linux but just opposite command of head. The interesting things over this command is that it shows the files from end to head. But head command has just opposite mechanism so, it is also called as the reverse command.Similar like head command this will also shows 10 lines of command by default. Head and Tail command are combined for the effectiveness of work of real time view.

We hope these guidelines help you to know Commands to View the Content of a File in Linux. If any queries arise regarding this topic then ICT BYTE recommend you to comment below. Here, we are always active to help you so don’t hesitate to share your doubt.

More From Author

Best Coding Books For Beginners

10 Best Coding Books For Beginners

C Program to add Two (Very) Large Numbers