Home >Operation and Maintenance >Linux Operation and Maintenance >View the path of files in Linux system
Viewing the full path of a file in a Linux system is very simple. You can print the absolute path of the current working directory by using the pwd
command, or use The readlink
command checks the absolute path of the specified file. Specific code examples will be introduced below:
Use the pwd
command to view the absolute path of the current working directory:
$ pwd
Executing this command will print out The absolute path of the current working directory, for example:
/home/user/documents
Use the readlink
command to view the absolute path of the specified file:
$ readlink -f 文件名
For example, if you want to view For the absolute path of the file test.txt
, you can enter the following command:
$ readlink -f test.txt
Executing this command will output the full path of the file test.txt
, for example:
/home/user/documents/test.txt
Through the above two methods, you can easily view the full path of the file in the Linux system.
The above is the detailed content of View the path of files in Linux system. For more information, please follow other related articles on the PHP Chinese website!