There are various files on the dedicated servers that can provide you with valuable information about the general status, current running condition and errors. Specially the files present in the /proc directory, can provide you with the complete system information. In order to view the files, you don’t really have to open them in a text editor, when the information can be displayed directly on your console with no trouble.
The “proc” is a virtual file system that is used as an interface to the kernel data structures. Usually, it is mounted at /proc directory. ‘Cat’ command is a Linux based command that enables you to view the contents of the text files without using the text editor. Using the Cat command followed by the specific file name is the simplest method of reading the file. Some examples for using the cat command on the dedicated servers are illustrated below.
In case you try to open large files in the text editor, you might encounter some issues, on the other hand if you open the same file using the cat command; all the contents of the file will be displayed immediately without any problems. You can also append “less” to the output, if you would like to check the file page by page. Have a look at the example given below:
cat mydoc.txt | less
You can also save the output contents in a file and download them so that they can be viewed offline as well. For this, you will have to type “cat” followed by an output redirection operator.
cat /proc/cpuinfo > /home/user/cpu-information.txt
The ‘cat’ command can also be utilized for linking multiple files together. This is one of the best and most convenient methods to combine files. See the example mentioned below:
cat myfile1 myfile2 myfile3
When the command mentioned above is fired, the output contents on your screen will be displayed, these contents can be sent to a file for downloading.
cat myfile1 myfile2 myfile3 > output.txt
You can easily view any of the file contents present on the dedicated server with the “cat” command. If you would like to get complete detailed information about the cat command, all you have to do is fire the “man cat” command from the command line.