Readlink commands in Linux

Source: Internet
Author: User

Original address: http://blog.csdn.net/liangxiaozhang/article/details/7356829

Readlink is a common tool used in Linux systems, primarily to find out where symbolic links are pointing.

Execute the following command in the Ubuntu system:

[Plain]View Plaincopy
    1. $ readlink--help

You can view the Help information for the Readlink command, or perform

[Plain]View Plaincopy
    1. $ mans Readlink

View the Help manual.

A description of the purpose of the Readlink command can be obtained from the Help information:

Output symbolic link value or authoritative file name

English is:

Print value of a symbolic link or canonical file name

Example:

In the end, which executable file does the awk command in the system execute?

[Plain]View Plaincopy
  1. $ readlink/usr/bin/awk
  2. /etc/alternatives/awk----> Actually, this is still a symbolic connection.
  3. $ readlink/etc/alternatives/awk
  4. /usr/bin/gawk----> This is the real executable file.

- f option:

The-f option can recursively follow all symbolic links that give a file name to standardize, except for the last one, all components must exist.

To put it simply, it is to follow the symbolic link until the file location of the non-symbolic link, the limit is the last file that must exist for a non-symbolic link.

[Plain]View Plaincopy
      1. $ readlink-f/usr/bin/awk
      2. /usr/bin/gawk

Readlink commands in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.