alias — Create a shortcut name for a longer command line across all 5 shells
Equivalents in every shell
alias ll='ls -la'Builtin. Aliases are simple string substitution at the start of a command and do NOT take arguments — use a shell function for parameterised shortcuts.
alias ll='ls -la'Same as bash. Zsh additionally supports `alias -g` (global, expanded anywhere on the line) and `alias -s` (suffix, by file extension) that bash lacks.
alias ll='ls -la'Fish implements aliases AS auto-generated wrapper FUNCTIONS rather than string substitutions. Inspect the wrapper with `functions ll`. Persist via `alias --save ll=...` (writes to `~/.config/fish/functions/`).
Set-Alias ll Get-ChildItemCRITICAL: PowerShell aliases map a NEW NAME to an EXISTING command — they cannot carry flags. `Set-Alias ll "ls -la"` is invalid. For aliases with arguments, define a function: `function ll { Get-ChildItem -Force $args }`.
doskey ll=dir /a $*Cmd has no `alias` keyword. `doskey` macros work but are PER-SESSION only — persistence requires loading a `doskey` file via a `cmd /k` startup script or the `AutoRun` registry key.
Worked examples
Define a short name for a verbose command
alias gs='git status'alias gs='git status'alias gs='git status'function gs { git status @args }doskey gs=git status $*List all currently defined aliases
aliasaliasGet-Aliasdoskey /macrosPersist an alias across new shell sessions
echo "alias gs='git status'" >> ~/.bashrcalias --save gs='git status''Set-Alias gs Get-Service' >> $PROFILEGotchas
- Bash aliases CANNOT take parameters. `alias greet='echo Hello $1'` will literally echo `Hello $1` — `$1` is empty at expansion time. Use a function instead.
- Aliases are NOT expanded in non-interactive shells by default. A bash script started with `#!/usr/bin/env bash` won't see your `~/.bashrc` aliases unless you `shopt -s expand_aliases` first.
- PowerShell `Set-Alias` aliases NAMES ONLY — you cannot bake flags or arguments into the alias. This is the single biggest porting pain when moving bash aliases. Use a `function` for anything with flags.
- Fish `alias` creates a function, so `funcsave foo` after defining it writes the wrapper to disk. Listing the alias via `type` shows the wrapper-function body, which can be confusing for users coming from bash.
- Cmd `doskey` macros do not persist — opening a new cmd window forgets all of them. Set `AutoRun` under `HKCU\Software\Microsoft\Command Processor` to a script that re-runs `doskey /macrofile=...` on every launch.