In this post we will see how to How to view file using terminal commands in CentOS. CentOS is a Community Enterprise operating system which mainly focuses on the server. It is a part of Linux Operating System Distribution, and it is free to use. First open the terminal.
Total Time Needed: 30 Minutes
CentOS
Step 1 : View files
To view files use the command less . For example to view a file passwd type the command less /etc/passwd
You can see that the file is opened- The difference between cat and less is that less opens the file itself whereas cat prints the file in the terminal. To go to next page press control +f in keyboard. To go to previous page press contro+b. To quit press q.
Step 2 : Search for a particular word in the File
To search for a particular word type / and enter the word that you want. For example, to search for word ntp type /ntp and press enter.
You can see that the searched word is highlighted in black
By following a simple process, you can create directories in steps, making it easier to organize and locate files. With just two steps, you can simplify the viewing of your files and access them quickly. This streamlined method can save time and improve your workflow.
To view a file in CentOS is as easy as these steps. If you have any doubts please reach Medha Hosting, our Linux experts will help you.
Read Here: How to compress files in CentOS?