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:
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
|
||||
|
||||
_1815 TILs and counting..._
|
||||
_1816 TILs and counting..._
|
||||
|
||||
See some of the other learning resources I work on:
|
||||
|
||||
@@ -1736,6 +1736,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [Display Free Disk Space](unix/display-free-disk-space.md)
|
||||
- [Display Line Numbers While Using Less](unix/display-line-numbers-while-using-less.md)
|
||||
- [Display The Contents Of A Directory As A Tree](unix/display-the-contents-of-a-directory-as-a-tree.md)
|
||||
- [Display The Target Of A Symbolic Link](unix/display-the-target-of-a-symbolic-link.md)
|
||||
- [Do A Dry Run Of An rsync](unix/do-a-dry-run-of-an-rsync.md)
|
||||
- [Do Not Overwrite Existing Files](unix/do-not-overwrite-existing-files.md)
|
||||
- [Download A File With Curl](unix/download-a-file-with-curl.md)
|
||||
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user