When working in a Linux environment, you spend most of your time dealing with the terminal. But sometimes you encounter a situation where you need to view a certain file, such as a picture or a word document (which cannot be viewed directly in the terminal). The usual approach at this time is to switch to the gui interface, go to the directory where the file is located, and double-click the file you want to open.
Another method is to directly enter the specified program in the shell to open the file, such as: evince xx.pdf to view a pdf file.
Use the command in the terminal to open the file:
1. Enter the command: cd folder-----Enter the folder, ll----View the files in the folder
2. How to open a file: To edit the file, use vi file name or vim file name. To exit, press ESC and enter: q! Enter.
To view the file, use cat file name or less file name
Online learning video sharing: linux video tutorial
The above is the detailed content of How to open a file in linux. For more information, please follow other related articles on the PHP Chinese website!