Method 1: Use the Vim text editor
Enter [vi file name.txt] in the terminal program. The "vi" part of the command selects the "Vim" text editor to open and edit the file. Replace "filename" in the command with the target filename.
(Online learning video tutorial sharing:linux video tutorial)
For example: the file name is "tamins", please enter vi tamins.txt and press the Enter key.
#When closing the file, enter: q in the terminal and press the Enter key. This will exit the Vim program and return to the terminal main interface.
Method 2: Use the cat command
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.
As shown in the picture:
Recommended related articles and tutorials:linux tutorial
The above is the detailed content of How to open text file in linux system. For more information, please follow other related articles on the PHP Chinese website!