Home > Article > Operation and Maintenance > how to open linux file
Method 1 (using Vim text editor):
1. Open the terminal. Click on the menu and find the Terminal program. The program's icon is a black box with a white ">_" on it. click it. The "Terminal" program can generally be found in the left column of the menu window.
#2. Enter vi filename.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.
For example, the file name is "tamins", please enter vi tamins.txt and press Enter.
Method 2 (using Emacs editor):
1. Enter emacs file name.txt in the terminal program. Here, the specific name of the text file is used instead of the "file name" in the command.
#2. Press the Enter key. If the entered file name exists, the command will open the existing file. If there is no file with the same name in the current path, this command can open a new text file in the Emacs editor.
For example, enter the emacs bbb.txt command to open the text file named "bbb".
3. Press Ctrl X when exiting, then press Ctrl C to exit the Emacs text editor and return to the path of the terminal.
Method 3:
1. 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.
Recommended related articles and tutorials: linux tutorial
The above is the detailed content of how to open linux file. For more information, please follow other related articles on the PHP Chinese website!