Back to basics day: a very simple tip on working with one of the most useful things available in Unix and Linux filesystems: symbolic links (symlinks).
How Symlinks Look in ls command
When using long-form ls output, symlinks will be shown like this:
greys@mcfly:~/proj/unixtutorial $ ls -la
-rwxr-xr-x 1 greys staff 819 14 Dec 2018 .gitignore
drwxr-xr-x 3 greys staff 96 20 Nov 09:27 github
drwxr-xr-x 4 greys staff 128 20 Nov 10:58 scripts
lrwxr-xr-x 1 greys staff 30 10 Dec 20:40 try -> /Users/greys/proj/unixtutorial
drwxr-xr-x 44 greys staff 1408 20 Nov 10:54 wpengine
Show Symlink Destination with readlink
As with pretty much everything in Unix, there's a simple command (readlink) that reads a symbolic link and shows you the destination it's pointing to. Very handy for scripting:
greys@mcfly:~/proj/unixtutorial $ readlink try /Users/greys/proj/unixtutorial
It has a very basic syntax: you just specify a file or directory name, and if it's a symlink you'll get the full path to the destination as the result.
If readlink returns nothing, this means the object you're inspecting isn't a symlink at all. Based on the outputs above, if I check readlink for the regular scripts directory, I won't get anything back:
greys@mcfly:~/proj/unixtutorial $ readlink scripts