Skip to content

Z Shellλ︎

Z Shell (zsh) is an advanced shell environment and shell scripting language for Linux/Unix systems.

Wikipedia - Z Shell

Preztoλ︎

OhmyZshλ︎

Command Historyλ︎

Up and Down navigate through the history of commands.

Edit last commandλ︎

Edit the previous command in the history if you know what it should be, e.g. if you typed got status instead of git statusthe you could run the command

Edit last command

fc -e astro -1 

Replace astro with either emacsclient, nvim, vim, nano or any preferred text editor.

Edit last command

Edit the got statusto git status and save & exit. Now the previous command is git status.

Change the -1 to if the command is further back in history (a known location)

Edit command historyλ︎

Edit the whole command history as a file, allowing easy removal of unwanted or duplicate commands using search and replace and other editing tools.

Edit entire history

```shell fc -W; astro "$HISTFILE"; fc -R ````

Replace astro with either emacsclient, nvim, vim, nano or any preferred text editor.

Shell aliases for commandsλ︎

Add aliases to $XDG_CONFIG_HOME/shell-aliases or your preferred location of shell alias definitions.

Shell Alias

# Shell history
# edit entire history
alias zsh-edit-history="fc -W; astro \"$HISTFILE\"; fc -R"

# edit previous command in history
alias zsh-edit-last-command="fc -e astro -1"

Alternativesλ︎

Referencesλ︎