Open A File In Linux

Open A File In Linux – Things that are difficult sometimes will become easier when we are used to doing it, as well as running some commands in the Terminal. Maybe for some users other than Linux, Linux is difficult to operate, especially if some activities / activities such as installing software / applications must use a console (terminal).

But unlike the case for Linux users themselves, they are even more comfortable if you run it using Terminal. Software installation, network configuration, file operation, etc. It would be more fun doing it using a console.

Well, this time I will share how to use the console to do activities more enjoyable. Here I only share about how to open files / files using Terminal on Linux, See the following Open A File In Linux tutorial, which you can easily try:

Open A File in Linux

In my opinion this method is very easy to do, especially if done at any time then you will get used to using the terminal in doing other activities. Okay, here are the steps on how to use Terminal to open a file:

Open the terminal then run the following command:

$ xdg-open nama_file

Example I will open a file with the file name Dangdut_koplo.mp3, then the command used is:

$ xdg-open Dangdut_koplo.mp3

Likewise to open other files, write also where the extractions of the file are like * .mp3, * .avi, * .mp4, * .zip, * .odt and others.

To open a file in another directory / folder, also include the name of the folder and sub-folder. For example, I want to open a file with the name journal.pdf in the Documents> Campus> Jurnal.pdf folder, then the command used is:

$ xdg-open Documents / Campus / Jurnal.pdf

And for other files that are in the folder or sub-folder. Different if you want to open a file with a name that is long and contains spaces, use the symbol / at the end of each word where the file is, write the command like this:

$ xdg-open nama_file

For example I will open a file with the name open source.odt in the Tutorials folder> Definitions> open source.odt, then the command used is:

$ xdg-open Tutorials / Definition / open \ source.odt

The Linux console has many ways to display a text file. The following is a command to display text with various advantages and disadvantages. For the demo, we will try to display the country.txt data that you can get here


Paint is a command to display screen text. Paint is suitable for text file sizes whose lines are less than 1 page screen. If a text has more than 1 screen display, only the final display appears

cat country.txt


more is a command that will be able to display text that is quite long. If a text is more than 1 page screen, then automatically more will only display the first screen. To display the next screen, press the space button.

the disadvantage of more is that it cannot display text on the previous screen.

more country.txt


less is more than more. the slogan of the less command is its ability is greater than the command more. the main advantage of less is the ability to see the page on the previous screen and see the screen afterwards. In addition, less can also be used to do string searches.

less country.txt


if the previous 3 commands can display all the contents of the text file, then this head command will normally only display 10 lines of text at the beginning of the file. If you want to display n lines then use the command pattern

head-line of country.txt. Example showing the first 5 lines with head

abc @ abc-ubuntu: ~ $ head -5 country.txt


tail is the opposite of head. tail by default will display the last 10 lines of a text file. tail is very suitable to be used to view the log server.

abc @ abc-ubuntu: ~ $ tail -5 country.txt

the five commands above you must understand because it is very useful when you handle the server. For example, use the command above, for example, to read manuals, text files, server logs, configuration files and so on. So many tutorials on how to use linux terminal to open files / files. Hopefully this Open A File In Linux information can be useful, good luck!