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

View the path of files in Linux system

PHPz
Release: 2024-02-23 20:45:06
Original
555 people have browsed it

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
    Copy after login

    Executing this command will print out The absolute path of the current working directory, for example:

    /home/user/documents
    Copy after login
  2. Use the readlink command to view the absolute path of the specified file:

    $ readlink -f 文件名
    Copy after login

    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
    Copy after login

    Executing this command will output the full path of the file test.txt, for example:

    /home/user/documents/test.txt
    Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template