Home  >  Article  >  Operation and Maintenance  >  View the path of files in Linux system

View the path of files in Linux system

PHPz
PHPzOriginal
2024-02-23 20:45:06496browse

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:

  1. 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
  2. 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!

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