1
0
mirror of https://github.com/jbranchaud/til synced 2026-07-11 01:16:09 +00:00

Add Display The Target Of A Symbolic Link as a Unix TIL

This commit is contained in:
jbranchaud
2026-07-10 13:57:59 -05:00
parent 33c8838d56
commit f74c17bc1e
2 changed files with 45 additions and 1 deletions
@@ -0,0 +1,43 @@
# Display The Target Of A Symbolic Link
I have symlinked binaries all over my machine. Many of them are configured via
my [dotfiles setup](https://github.com/jbranchaud/dotfiles). There are also
tools like `uv` that install CLI tooling in a canonical place and then symlink
it to a more user-friendly location.
`ruff` which I [installed as a CLI tool via
`uv`](python/globally-install-cli-tool-with-uv.md) is a good example of this.
When I look at the location of `ruff` via the `which` command, I get a `bin`
directory that differed from where I expected `uv` to install it.
```bash
which ruff
/Users/lastword/.local/bin/ruff
```
When I `ls` that directory, I can see it is full of symlinked binaries (as
annotated by the trailing `@` symbol).
```bash
ls /Users/lastword/.local/bin
 ./  cursor-agent@  pplay@  tmux-fork-repo@
 ../  figprev@  pyright@  tmux-new-session@
 agent@  ghprs@  pyright-langserver@  v@
 bic@  git_better_branch@  pyright-python@  wait_for_port@
 bip@  local-clone@  pyright-python-langserver@
 claude@  nvims@  ruff@
 command-history-preview@  pingf@  task*
```
To resolve one of these symlinks to their target location, I can use the
`readlink` utility.
```bash
readlink /Users/lastword/.local/bin/ruff
/Users/lastword/.local/share/uv/tools/ruff/bin/ruff
```
And there it is, the actual directory where I expected `uv` to have installed
`ruff`.
See `man readlink` for more details.