How to know if a folder is a symbolic link?
Solution 1:
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.
-
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 t domain users 4096 mai 24 15:56 original lrwxrwxrwx 1 t domain users 8 mai 24 15:56 symbolic -> original
Here
symbolic
is a symbolic link pointing tooriginal
folder.The starting
l
inlrwxrwxrwx
represents a symbolic link, whiled
represents folder (directory), and-
represents file.
Solution 2:
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
Solution 3:
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