You can determine the absolute path of any file in Windows by right-clicking a file and then clicking Properties. In the file properties first look at the "Location:" which is the path to the file.
The pwd command displays the full, absolute path of the current, or working, directory.
To obtain the full path of a file, we use the readlink command. readlink prints the absolute path of a symbolic link, but as a side-effect, it also prints the absolute path for a relative path. In the case of the first command, readlink resolves the relative path of foo/ to the absolute path of /home/example/foo/.
realpath
isn't available on all linux flavors, but readlink
should be.
readlink -f symlinkName
The above should do the trick.
Alternatively, if you don't have either of the above installed, you can do the following if you have python 2.6 (or later) installed
python -c 'import os.path; print(os.path.realpath("symlinkName"))'
realpath <path to the symlink file>
should do the trick.
unix flavors -> ll symLinkName
OSX -> readlink symLinkName
Difference is 1st way would display the sym link path in a blinking way and 2nd way would just echo it out on the console.
Another way to see information is stat
command that will show more information. Command stat ~/.ssh
on my machine display
File: ‘/home/sumon/.ssh’ -> ‘/home/sumon/ssh-keys/.ssh.personal’
Size: 34 Blocks: 0 IO Block: 4096 symbolic link
Device: 801h/2049d Inode: 25297409 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 1000/ sumon) Gid: ( 1000/ sumon)
Access: 2017-09-26 16:41:18.985423932 +0600
Modify: 2017-09-25 15:48:07.880104043 +0600
Change: 2017-09-25 15:48:07.880104043 +0600
Birth: -
Hope this may help someone.
You can use awk
with a system
call readlink
to get the equivalent of an ls
output with full symlink paths. For example:
ls | awk '{printf("%s ->", $1); system("readlink -f " $1)}'
Will display e.g.
thin_repair ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_restore ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_rmap ->/home/user/workspace/boot/usr/bin/pdata_tools
thin_trim ->/home/user/workspace/boot/usr/bin/pdata_tools
touch ->/home/user/workspace/boot/usr/bin/busybox
true ->/home/user/workspace/boot/usr/bin/busybox
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With