All Products
Search
Document Center

Object Storage Service:read-symlink

Last Updated:Aug 14, 2024

You can run the read-symlink command to query information about a symbolic link, including the ETag and last modified time. To run this command to query information about a symbolic link, you must have read permissions on the symbolic link.

Usage notes

  • For ossutil 1.6.16 and later, you can directly use ossutil as the binary name in the command line. You do not need to update the binary name based on the operating system. For ossutil earlier than 1.6.16, you need to update the binary name based on the operating system. For more information, see ossutil command reference.

  • For more information about symbolic links, see Create symbolic links.

Command syntax

ossutil read-symlink oss://bucketname/objectname [--encoding-type <value>] [--payer <value>]

The following table describes the parameters and options in the command syntax.

Parameter/Option

Description

bucketname

The name of the bucket.

objectname

The name of the symbolic link.

--encoding-type

The method that is used to encode the name of the symbolic link. Valid value: url. If you do not specify this option, the name is not encoded.

--payer

The payer of the request. If you want the requester who accesses the resources in the specified path to pay the fees that are generated by the operation, such as traffic and request fees, set this parameter to requester.

Examples

The following command queries information about a symbolic link named test.jpg in a bucket named examplebucket:

ossutil read-symlink oss://examplebucket/test.jpg

The following output indicates that the information about test.jpg is obtained, including the ETag value, last modified time, and the object to which the symbolic link points. According to the output, test.jpg points to an object named example.jpg.

Etag                    : 938F26218CE422CBEEE0B6543A2B2D
Last-Modified           : 2021-04-21 18:00:13 +0800 CST
X-Oss-Symlink-Target    : example.jpg
0.217317(s) elapsed

If you run the command to query an object that is not a symbolic link, NotSymlink is returned.

Common options

If you use ossutil to switch to a bucket that is located in another region, add the -e option to the command to specify the endpoint of the region in which the specified bucket is located. If you use ossutil to switch to a bucket that belongs to another Alibaba Cloud account, add the -i option to the command to specify the AccessKey ID of the specified account, and add the -k option to the command to specify the AccessKey secret of the specified account.

For example, you can run the following command to query information about a symbolic link named testobject.png in the testbucket bucket that is located in the China (Shanghai) region and owned by another Alibaba Cloud account:

ossutil read-symlink oss://testbucket/testobject.png -e oss-cn-shanghai.aliyuncs.com -i LTAI4Fw2NbDUCV8zYUzA****  -k 67DLVBkH7EamOjy2W5RVAHUY9H****

For more information about common options, see Common options.