Configure defaults for Bash, Zsh, or PowerShell
The default shell for operating systems is typically:
- Linux: Bash
- macOS: Zsh
- Windows: PowerShell
Each shell vendor has configuration files to change the default shell parameters. Here are some useful examples:
Remove duplicate entries in shell history
To remove duplicate entries in shell history for pressing “up” on repeated commands to give the last non-duplicated command, set for the respective shell as follows.
Bash: “~/.bashrc”: ignore duplicate lines, and omits lines that start with space.
export HISTCONTROL=ignoredups:ignorespaceZsh: “~/.zshrc”
setopt hist_ignore_dups
setopt hist_ignore_spacePowerShell: “$profile”: set the history to ignore duplicates.
Set-PSReadlineOption -HistoryNoDuplicates