Monday, October 04, 2010

Techie Tidbits: Resolving Symlinks

If you use a linux distro that uses the alternatives framework, from time to time you might need to know where or what those symlinks eventually point to; this was the case for me when I needed to know where my JRE home was... and which java wasn't helping me (much). Google introduced me to readlink which has an -e or -f option which basically switches on recursion. So something like readlink -f `which java` told me what I needed to know. I went a step further and created two aliases in my ~/.bash_aliases file (sourced from ~/.bashrc), like so:
alias rle='readlink -e'
alias rlf='readlink -f'
So rlf `which java` saves you 7 key presses. All things considered the speed up is probably going to be marginal, but everything helps right?

No comments: