Nowadays Linux is one of the most popular operating systems on the market, But, despite that its use is very minimal since there are very few users who handle a computer with this OS. One of the main reasons why this system It is not so widely used it is due to its complexity of use, taking into account that handles basically via commands.
When dealing with commands practically all its functions are carried out under the application of them. In this way, Linux offers different types of commands that will allow you to perform various tasks, including that of view, edit and create files. It should be remembered that one of the most frequent actions in computers is to view the content of the files, so knowing each of these addresses is very important.
In accordance with all this and taking into account the complexity of use of this OS, here we are going to show you how you can start viewing each of the files that you have stored on your computer in an easy and fast way. To do this, follow in detail everything that we will teach you below.
What are the commands used to view files in Linux?
One of the advantages of this OS is that it offers a great variety of commands at the moment of wanting to perform any type of activity, in the case of view files users have the opportunity to have a great variety of them. Here they can be found lines of codes either to just visualize them, to edit or create them, bearing in mind that files are one of the most important elements on any computer.
To make Linux handling much easier for you, here we are going to show you some of the most used commands when viewing files on the PC:
- ELDER BROTHER
These are just some of the most used lines of text in Linux to carry out this type of actionSo that you can understand this a little better, next we are going to teach you a little more about the operation of each of them.
Learn step by step how to view files on your computer with Linux
To be able to view files in a Linux computer it is necessary to apply different types of commands that will allow you to execute this actionThis is how here we are going to teach you each one of them so that you can perform these procedures in an easy and fast way.
To do this, follow each of the lines that we will teach you below:
East tail code will allow you to see a part of the information that is contained in a file. For the use of this command there are two arguments that are very popular in this case. The first of it is the “N” which indicates the number of rows to be show from end of content and the second argument is the “F”, this will allow you to always have the latest information in real time. In this case it is a updated file in output standard, which is very interesting and necessary at the time of open files.
When applying the CAT text line you will have the opportunity to read all the content of a Text file, so you will get the visualization of it. Another of its functions is that it gives you the possibility of linking different files and presenting all the content in the output standard. We can say that cat It’s one of the most used commands since it offers speed when viewing the content stored there.
At the time of write in the text line less you will have the opportunity to see the content of a page to page file, so it will allow you navigate in the content of the file either going backwards or forwards freely. If you want to advance to a whole page, then use the key “PgDn” or “page down” to advance a single line.
In the case that you already want to leave the editor, then you simply have to press the q key. While for use command you just have to write Less [nombre_archivo]”.
In the case of nl command it is very similar to the one already mentioned cat, but the main difference between the two is that apply nl the line numbers are displayed next to the file content on the computer. You can too apply cat –n and you can get the same results. Keep in mind that if they show the number of lines is very important, as this will show if there are errors in the configuration files.
At the time of apply head code you will also have the opportunity to view content stored in a document, by default, this command will only allow you to know the content of the first 10 lines of the file.
Vim is known as a console text editor, which is considered one of the more powerful and popular. In this case, it should be mentioned that it is not so easy to handle, so learning will be somewhat complicated. If Vim It should be mentioned that it is not pre-installed in any or almost none of Ubuntu distributions, but which if it is available in the official repositories of the system.
This allows you to be able to install it as a command, whether you are in Debian, Ubuntu, or any other. To do this you need to apply this command “sudo apt install vim”. So you can start the vim editor you will only have to open a window in the terminal and write this command: “vim”.
After this you will see a small project presentation text, in it you will have the possibility of open different types of files. As already mentioned, power managing this editor is not that simple so you will need time and dedication to learn how to use it, but it becomes one of the best options to start viewing text files.
To continue on Linux text editors now we present the command Elder brother, Unlike the previous one, here you will not only have the opportunity to visualize the files, but you can also edit and modify them as you think necessary.
In order to open this text editor you need to type the following command in the terminal: “Nano”. It will automatically open for you and at the bottom of the screen you will see how they are displayed the different key combinations that you will need to use when working with the program.
This command is used mainly to view the files and send them to print. It basically performs the same function as cat command but the main difference of this is that more page all the content of the file. Also, this command is much more suitable for when you want read files that are long.
By applying it you will have the opportunity to print the entire file content on the screen, but with a paged result. In this case the lines that fit on your computer screen will be displayed without capturing. To apply this command you must enter the following in the text line: “More filename”.
Thanks to this command you will have the opportunity to deletear files or directories that you no longer need. In order to delete the files you must run the command $ rm /home/test.txt
This command also offers you other options that are important to take into account, the –r option it allows you delete all files and directories recursively, if you apply –f you can delete everything if the need to confirm the action. You can also combine both options causing a recursive and uncommitted deletion of the specified directory. In order to do this, it will be necessary to apply this command: $ rm –fr / home / backups
If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thank you! 😉