Comment

Comment by scns

For his usecase of funky i use ~/.bash_aliases, that way i can easily share them between machines. Eg to quickly add a new one: alias als="nvim $HOME/.bash_aliases && source $HOME/.bash_aliases"

Be careful with quoting though, got myself into a situation where every new terminal asked for the root password. Shellcheck found the reason quickly.

(edit) Another benefit is that those aliases abstract over differences of invocation on different distros. Here are some examples:

# PACKAGE MANAGEMENT

alias pcl="sudo zypper cc && sudo zypper purge-kernels"

alias pin="sudo zypper install -y"

alias pla="zypper search"

alias pli="zypper packages --installed-only | rg "

alias plu="zypper list-updates && zypper list-patches"

alias pre="sudo zypper remove"

alias pup="far too long" # upgrade all packages and ask for confirmation

alias pups="far too long + shutdown" # upgrade all packages without confirmation && shut down

# QUICK EDITS

alias als="nvim ~/.alias && source ~/.alias"

alias brc="nvim ~/.bashrc && source ~/.bashrc"

alias egr="sudo nvim /etc/default/grub && sudo update-grub"

alias fst="sudo nvim /etc/fstab"

alias pro="nvim ~/.profile && source ~/.profile"

# QUICK MOVEMENTS

alias ..="cd .."

alias ...="cd ../.."

alias ....="cd ../../.."

alias sc="shellcheck"

# SYSTEMD

alias sden="sudo systemctl enable --now"

alias sdls="sudo systemctl --type=service"

alias sds="sudo systemctl start"

# VIM

alias nrc="cd ~/.config/nvim/ && nvim init.lua"

alias nv="nvim"

alias scratch="nvim scratch.txt"

parent scns 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton