Home  >  Article  >  Operation and Maintenance  >  What are the commands to open files in Linux?

What are the commands to open files in Linux?

藏色散人
藏色散人Original
2020-08-25 11:55:0628568browse

The commands to open a file in Linux are: 1. cat command, used to view the file content; 2. tac command, displayed from the last line; 3. nl command, output the line number when displayed; 4. The more command is used to display file contents page by page, etc.

What are the commands to open files in Linux?

Recommended: "linux course"

Open the terminal program and directly use the cat command to view the contents of the file sample. Just type cat sample.txt at the prompt and press Enter. The function of the cat command is to display the entire file content starting from the first line.

What are the commands to open files in Linux?

In Linux systems, there are many commands to view the contents of text files, such as cat/tac/nl/more/less/head/tail and other commands. In addition to the functions of other cat commands mentioned above:

1, tac: start displaying from the last line, you can see that tac is in the opposite alphabetical order of cat;

2, nl: output the line number when displaying ;

3, more: display the file content page by page;

4, less is similar to more, but it can turn pages forward;

5, head : Read only the first few lines;

6, tail: Read only the last few lines;

7, od: Read the file in binary mode.

The above is the detailed content of What are the commands to open files in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn