How to know if a folder is a symbolic link?

To determine whether the folder is a symbolic link you can use either of these methods.

  • GUI Method:

    The folder icon will be different. The icon of the folder would have an arrow.

    icon difference

  • CLI Method

    The output of ls -l will clearly indicate that the folder is a symbolic link and it will also list the folder where it points to.

    $ ls -l
    total 4
    drwxr-xr-x 2 jabard domain users 4096 mai  24 15:56 original
    lrwxrwxrwx 1 jabard domain users    8 mai  24 15:56 symbolic -> original
    

    Here symbolic is a symbolic link pointing to original folder.

    The starting l in lrwxrwxrwx represents a symbolic link, while d represents folder (directory), and - represents file.


There are many ways, my usual way is using stat

guiverc@ultracrap:~$   stat vids
  File: vids -> Videos/
  Size: 7               Blocks: 0          IO Block: 4096   symbolic link
Device: fd00h/64768d    Inode: 524725      Links: 1
Access: (0777/lrwxrwxrwx)  Uid: ( 1000/ guiverc)   Gid: ( 1001/ guiverc)
Access: 2019-05-25 00:16:26.708558789 +1000
Modify: 2019-05-25 00:16:26.708558789 +1000
Change: 2019-05-25 00:16:26.708558789 +1000
 Birth: -

You'll note my ~/vids is a symbolic link to my ~/Videos/ directory


Alternative approach:

1, using file

file /usr/lib/jvm/jre-9
/usr/lib/jvm/jre-9: symbolic link to /etc/alternatives/jre_9

2, using readlink

readlink -f /usr/lib/jvm/jre-9
/usr/lib/jvm/java-9-openjdk-9.0.4.11-6.fc28.x86_64

Here you can see that path is expanded to link target