Home > Linux Knowledge > Living in the terminal
published 2024-11-12
Your steps to terminal wizardry
First, you need a good shell, Bash is not a good shell. Zsh, or even better: Yash are preferred options. Yash is super fast, even more POSIX compliant than Zsh (or Bash) and is made for interactive use. Yash sources ~/.yashrc for configuration.
Before usage copy the basic .yashrc to your home drive:
cp /usr/share/yash/initialization/sample ~/.yashrc
Edit .yashrc to add your profile options (aliases, environment variables, path extensions):
##### Sample Yashrc #####
# This is a sample initialization script for yash. Copy this file to ~/.yashrc
# and add your favorite customization to it.
# Firstly, load the common customization script.
# If you don't like settings applied in this script, remove this line.
. --autoload --no-alias initialization/common
# These are additional aliases that are not defined in the common script.
# Uncomment to enable them.
alias g='grep'
alias l='$PAGER'
alias --global L='|$PAGER'
alias --global N='>/dev/null 2>&1' N1='>/dev/null' N2='2>/dev/null'
# Uncomment if you want to clear the screen with Ctrl-L.
#bindkey --emacs '\^L' clear-and-redraw-all
#bindkey --vi-insert '\^L' clear-and-redraw-all
#bindkey --vi-command '\^L' clear-and-redraw-all
# Uncomment to enable direnv support. (jq required)
_update_direnv() {
eval "$(
direnv export json |
jq -r 'to_entries | .[] |
if .value == null then
@sh "unset \(.key)"
else
@sh "export \(.key)=\(.value)"
end'
)"
}
_update_direnv
YASH_AFTER_CD=("$YASH_AFTER_CD" '_update_direnv')
# And add your own customization below.
# user env vars
export PATH="$(go env GOPATH)/bin:$PATH"
export PATH="/home/$USER/bin:$PATH"
export EDITOR=micro
export LC_ALL=en_IE.utf8
# user aliases
alias ls='lsd'
alias lsa='lsd -lah'
alias tree='broot -s'
alias df='duf'
Useful terminal utilities
Good starting point: Modern Unix
- lsd (ls on steroids)
- bat (cat with syntax highlighting and git support)
- jq (sed for json)
- lazygit (TUI for git)
- duf (df for humans)
- broot (tree for humans)
- direnv
- btm (top / htop alternative)
Terminal fun
- cowsay
- fortune (fortune-mod on Void)
- cmatrix (no explanation needed here)
- asciiquarium