unalias — Remove an alias previously defined with alias across all 5 shells
Equivalents in every shell
Bashunix
unalias llBuiltin. `unalias -a` removes ALL aliases at once. Removing a non-existent alias is an error.
Fishunix
functions --erase llFish stores aliases AS functions, so removal is `functions --erase` (shortcut: `functions -e`). Fish 3.4+ also accepts `alias --erase ll` as a friendlier synonym.
PowerShellwindows
Remove-Item Alias:llAliases live on the `Alias:` PSDrive. `Remove-Item Alias:ll` deletes one; `Remove-Item Alias:*` clears them all (rarely what you want — many built-in cmdlets rely on Unix-name aliases).
cmd.exewindows
doskey ll=A doskey macro is removed by re-assigning it to an empty value (`name=` with nothing after `=`). There is no dedicated `unalias`-style keyword.
Worked examples
Remove a single alias
Bash
unalias llZsh
unalias llFish
functions --erase llPowerShell
Remove-Item Alias:llcmd.exe
doskey ll=Remove every alias in the current shell
Bash
unalias -aFish
for a in (alias); functions --erase (string split = -- $a)[1]; endPowerShell
Get-Alias | ForEach-Object { Remove-Item Alias:$($_.Name) -Force -ErrorAction SilentlyContinue }Temporarily bypass an alias without removing it (call the underlying command)
Bash
\ls -laZsh
\ls -laPowerShell
& "ls.exe" -laGotchas
- `unalias` only affects the CURRENT shell. To persist removal, edit the file that defined the alias (typically `~/.bashrc` or `~/.zshrc`) so the next session never sees it.
- PowerShell aliases have an `-Option` flag — many built-ins like `cd`, `dir`, `ls` are `ReadOnly` and cannot be removed without `Remove-Item Alias:cd -Force`. `Constant` aliases survive even that — you'd need a new runspace.
- Fish has no `unalias` keyword — running it errors with `Unknown command`. Always use `functions --erase` (aliases were defined as functions in the first place).
- Cmd's `doskey name=` only removes the macro from the CURRENT session. Restarting cmd brings it back if loaded by AutoRun or a startup script — edit the source file too if you want a permanent removal.
- `unalias -a` is destructive and often surprising — it strips safety aliases like `alias rm='rm -i'` that your distro set up. Use `unalias` with explicit names unless you really mean all.
WSL & PowerShell Core notes
pwshLinux/macOS pwsh ships with FEWER built-in aliases than Windows pwsh because the Unix-style ones (`ls`, `cat`, etc.) are intentionally removed. `Get-Alias` on Linux is a shorter list, and `Remove-Item Alias:ls` will error 'not found' rather than removing anything.
WSLWSL aliases (bash/zsh) are unrelated to Windows aliases. Removing an alias inside WSL requires the appropriate Unix invocation (`unalias`). There is no cross-system 'unalias everywhere' operation.