List all shell aliases
Print every alias currently defined in the shell — for debugging "why does `ls` behave differently here" and auditing dotfiles.
How to list all shell aliases in each shell
aliasBare `alias` (no args) lists all currently-defined aliases. Format: `alias name='expansion'`. To check ONE alias: `alias ls`. Aliases live in `~/.bashrc` (re-loaded each interactive shell) — non-interactive scripts (cron jobs) do NOT inherit them by default.
aliasSame `alias` builtin. Zsh has THREE kinds: regular (`alias`), global (`alias -g UP="../"` — expands anywhere on the line), and suffix (`alias -s txt=cat` — runs cat when you type a `.txt` filename). `alias -L` lists in re-loadable form.
aliasFish `alias` is actually a wrapper that creates FUNCTIONS — `alias ll="ls -l"` becomes a `function ll; ls -l $argv; end`. So `alias` (no args) only lists alias-created functions, NOT functions you wrote by hand. To see EVERYTHING: `functions` (lists all functions including alias-made).
Get-AliasReturns objects with `Name`, `Definition`, `Source` properties. Filter: `Get-Alias | Where-Object Source -eq Microsoft.PowerShell.Utility`. Pwsh aliases are STATIC name-substitutions (Bash-style), not arbitrary text-expansion — for that use FUNCTIONS.
doskey /macroscmd has NO native aliases — `doskey` is a separate macro system that ships with Windows. Macros only persist for the current cmd session (unless you AutoRun a script via `HKCU\Software\Microsoft\Command Processor\AutoRun`). For real aliasing on Windows, use pwsh.
Equivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.
Gotchas & notes
- **Alias re-loading semantics**: bash + zsh aliases are TEXTUAL substitutions resolved at PARSE TIME — they don't work inside script files (only interactive shells expand them by default). To use aliases in a script: `shopt -s expand_aliases` (bash) at the top. Scripts that DEFINE aliases also need to source the file (`source ~/.bashrc`) BEFORE the alias use — function-defined-then-immediately-called won't see the alias unless the shell has already finished parsing the function body. Common gotcha: `alias ls=lsd; ls` works at terminal; `bash -c "alias ls=lsd; ls"` does NOT (alias expansion off in `-c` mode).
- fish-specific: `alias` is sugar over `function` — meaning fish aliases inherit ALL function features including argument forwarding (`$argv`), local variables, and the `--save` flag (`alias --save ll="ls -l"` writes a `functions/ll.fish` file under `~/.config/fish/functions/` so it persists). Standard fish convention is to write a `~/.config/fish/functions/<name>.fish` file directly — fish auto-loads function definitions on first use (lazy loading, faster startup than bash/zsh's eager rc-file processing).
- pwsh aliases are LIMITED to name-substitution — `Set-Alias ll "Get-ChildItem -Force"` does NOT work (you cannot bake arguments into an alias, only the cmdlet name). For "alias with default args" use a FUNCTION: `function ll { Get-ChildItem -Force @args }`. The `@args` is splatting — pwsh's equivalent of bash `"$@"`. Built-in aliases like `dir`, `ls`, `cp`, `mv` are aliases for `Get-ChildItem`, `Get-ChildItem`, `Copy-Item`, `Move-Item` — they exist for muscle-memory compatibility, but their semantics differ from POSIX versions (`-Recurse` not `-R`).
- For an audit of ALL THE THINGS that override `ls` (or any command): bash `type -a ls` lists every match in order — alias, function, builtin, file. zsh has the same `type -a`. fish: `type --all ls` (long-form). pwsh: `Get-Command ls -All` shows aliases, cmdlets, functions, applications in priority order. cmd: no equivalent — manually check `doskey /macros | findstr ls`, then `where ls.exe`. The "type -a" output is the single best tool for "why does this command resolve to that" — it shows the entire override stack.
Related commands
Related tasks
- Show the file path of a command— Print where on the filesystem a command resolves to — for debugging PATH issues, version mismatches, and "which python is this".
- Detect the current shell— Determine which shell (bash / zsh / fish / pwsh / cmd) is currently running — for conditional dotfile loading and script-detection scenarios.
- Source an env file into the current shell— Load variables from a `.env`-style file into the current shell session — for project-specific secrets, dev-mode flags, and tool-version locks.
- Prepend a directory to PATH— Add a directory to the FRONT of PATH so commands inside it override system equivalents — for tool-version pinning (node@18 vs system node) and local-bin priorities.