Linux Command for Reading Help Files for a Command or Application

Open File in Linux

There are diverse ways to open a file in a Linux system. Information technology is a fairly straight frontwards process to view the contents of a file, simply if y'all are a new user, it may bother you. It is non as piece of cake as opening a file in Notepad. From the Linux last, you must take some exposures to the Linux bones commands. In that location are some commands such as cat, ls, that are used to read files from the concluding.

In Linux, nosotros can display various file formats such as text file, audio files, video, image, physician, pdf, or any other file contents.

Open File in Linux

Following are some useful ways to open a file from the terminal:

  1. Open the file using cat command.
  2. Open the file using less control.
  3. Open the file using more control.
  4. Open up the file using nl command.
  5. Open the file using gnome-open command.
  6. Open up the file using head command.
  7. Open the file using tail command.

ane. Open File Using cat Command

This is the most pop and easy way to display the file content. It simply prints the file content to the terminal. It provides many options to go far more specific. To go in-depth with true cat command, visit Linux cat.

To display the file content, execute the true cat command as follows:

Let'south create a file to empathize how to open a file. Execute the beneath command:

The above command will create a text file 'Examination.txt.' In that location are multiple ways to create a file, To acquire, visit Linux Create File.

To display the file content of the higher up file, execute the control equally follows:

true cat Text.txt

Consider the below output:

Open File in Linux

The true cat command is a very useful utility to open a file, simply the chief result with it that it displays the file content on the terminal. If we accept a large file, then it is not an ideal fashion to open a file. In such a situation, the less command volition be handy as it displays a page at a time.

ii. Open File Using less Control

The less command allows usa to view ane page at a time.

To display the file content, execute the less command as follows:

The higher up command will display the file content as a folio at a time. To view more, scroll the output. Consider the below output:

Open File in Linux

To leave from the less command, printing the 'q' key, and you volition exist back to the terminal. To become in-depth with less command, visit Linux less.

3. Open File Using more Command

The Linux more command is also used to display the file content. As the less command automatically adjusts the height and width of the final window, it cuts the content as the width of the terminal.

Utilise the following keys to scroll the output:

Press ENTER key to scroll down folio line past line.

Printing the Space bar to get to the next page.

Printing 'b' cardinal to go to the back page.

Press '/fundamental:' to search the string.

To brandish the file content by the more command, execute information technology every bit follows:

The to a higher place command volition display the file content as the width of the last window. Consider the beneath output:

Open File in Linux

To go in-depth with the more control, visit Linux more.

4. Open File Using nl Command

The nl control displays the file content with the line number. It is almost the same every bit the cat command. The major difference between both commands is that it prepends line numbers while displaying the output in the last.

To display the file content with nl command, execute the control as follows:

The higher up command will display the file content with the line number. Consider the below output:

Open File in Linux

5. Open up File Using gnome-open up Command

For the GNOME-based Linux environment, we can use the gnome-open command to open a file.

If the gnome utility is not installed on our machine, we can install it by using the following command:

Execute the above command and provide the system administrator password to install the GNOME utility.

Now, to display the file content, execute the command equally follows:

The above command will open the file with the default file organization. Consider the below snap of the file system:

Open File in Linux

There are another popular Linux environments, such as KDE DESKTOP, OS X UNIX, and more.

For KDE Desktop, execute the command as follows:

or,

For Bone X UNIX, execute the command equally follows:

We can display the file content by using the head command, but it is slightly different than others. Information technology displays the beginning role of files via standard input. By default, it displays the offset ten lines of the files. Information technology starts reading the file from the head (first line).

To open a file by using the head command, execute the control as follows:

The above command will brandish the content of the specified file. To become in-depth with the head command, visit Linux Head.

7. Open the file past Using tail Control.

The tail command is like to the head command. The difference between both commands is that it starts reading the file from the tail (terminal line). Similar to head command, information technology also displays the output of the last ten lines by default.

To open the file by using the tail command, execute the control as follows:

The higher up control will brandish the content from the last line of the specified file. To go in-depth with the tail control, visit Linux Tail.


rayessirks1991.blogspot.com

Source: https://www.javatpoint.com/open-file-in-linux

0 Response to "Linux Command for Reading Help Files for a Command or Application"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel