Skip to content
shellmap

Find symbolic links in a directory

List every symlink under a directory tree, optionally with their targets and broken-link detection.

How to find symbolic links in a directory in each shell

Bashunix
find . -type l

Add `-ls` to show the link target: `find . -type l -ls`. Broken links: `find . -xtype l` (GNU only; BSD `find` lacks `-xtype`).

Zshunix
find . -type l
Fishunix
find . -type l
PowerShellwindows
Get-ChildItem -Recurse -Force | Where-Object { $_.LinkType -eq "SymbolicLink" }

`LinkType` can also be `Junction` or `HardLink` on Windows. Without `-Force`, hidden symlinks (e.g. inside `AppData`) are skipped.

cmd.exewindows
dir /AL /S

`/AL` selects **reparse points** — symlinks AND junctions; Windows does not distinguish at this level. The arrow notation in output shows the target with `<SYMLINK>` or `<JUNCTION>`.

Equivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.

Gotchas & notes

  • Windows symbolic links (since Vista) require **admin or Developer Mode** to create — many older "symlinks" on Windows are actually **junctions**, a different reparse-point type that only works for directories.
  • GNU `find -xtype l` finds **dangling** symlinks (target does not exist). On BSD/macOS, use `find . -type l ! -exec test -e {} \; -print`.
  • PowerShell `Get-Item link.txt | Select-Object Target` resolves a symlink. `Resolve-Path -Path link.txt` follows the full chain to a real path.
  • WSL `/mnt/c` symlinks created from inside WSL are stored as **WSL-only metadata** unless `metadata` mount option is on — Windows-native tools (`dir`, Explorer) will not follow them.

Related commands

Related tasks