SHARE WITH THE CLASS: What aliases are you using?

macallik@kbin.social to Linux@lemmy.ml – 139 points –

From bash to zsh and everywhere in between, show me yours and I'll show you mines. Inspire others or get some feedback.

Simply copy & paste the output of alias in your terminal or add some comments to explain things for others.

Edit: Kbin users, click 'More' on a comment and use the fediverse link to read responses that have funky formatting

114

You are viewing a single comment

I got so much crap gathered throughout the years... some of them I don't even use, but, here they are:

#!/usr/bin/zsh
# vi: ft=zsh

#############
# zsh aliases
#############

# grep
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias zgrep='zgrep --color=auto'

# processes
#alias pss='ps auxww | grep -v grep | grep'   # show all processes with user, hide grep itself
alias top='top -i -e m -E m'                # hide inactive and zombie processes, show ram in MB

# update system
alias p='sudo pacman'
alias pu='paru -Sua --noconfirm'
# clean up
alias pc='sudo pacman -Rsn $(pacman -Qdtq) --noconfirm 2>/dev/null; paru -Sccd --noconfirm'

# lvim
alias nvim='lvim'
alias vim='lvim'
alias vi='lvim'
alias v='lvim'

# cpg & mvg
alias cp='/usr/bin/cpg -ig'
alias mv='/usr/bin/mvg -ig'

# other useful ones
alias rm='trash'
alias duu='du -d 1 -h'

# wayland
alias gparted='sudo /bin/env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY"  XDG_RUNTIME_DIR=/user/run/0  /usr/sbin/gparted'

# edit configs
alias vcs="$EDITOR $XDG_CONFIG_HOME/starship/config.toml"     # starship
alias vca="$EDITOR $XDG_CONFIG_HOME/alacritty/alacritty.yml"  # alacritty
alias vct="$EDITOR $XDG_CONFIG_HOME/tmux/tmux.conf"           # tmux
alias vcv="$EDITOR $XDG_CONFIG_HOME/nvim/init.vim"            # neovim
alias vcl="$EDITOR $XDG_CONFIG_HOME/lvim/config.lua"          # lunarvim
alias vch="$EDITOR $XDG_CONFIG_HOME/hypr/hyprland.conf"       # hyprland
alias vcw="$EDITOR $XDG_CONFIG_HOME/waybar/config"            # waybar

# edit & source zsh configs
alias scz="source $ZDOTDIR/.zshrc"
alias vcz="$EDITOR $ZDOTDIR/.zshrc && source $ZDOTDIR/.zshrc"
alias vczo="$EDITOR $ZDOTDIR/options && source $ZDOTDIR/options"
alias vczb="$EDITOR $ZDOTDIR/bindkeys && source $ZDOTDIR/bindkeys"
alias vcze="$EDITOR $ZDOTDIR/exports && source $ZDOTDIR/exports"
alias vcza="$EDITOR $ZDOTDIR/aliases && source $ZDOTDIR/aliases"
alias vczc="$EDITOR $ZDOTDIR/completions && source $ZDOTDIR/completions"
alias vczf="$EDITOR $ZDOTDIR/functions && source $ZDOTDIR/functions"

# other cool toys
alias exa='exa --long --header --git --sort=name --group-directories-first'
alias ls='exa'
alias cat='bat -pp'
alias bat='bat --style=full'

# x11
# alias X='startx ${XDG_CONFIG_HOME}/X11/xinitrc'
# alias XX='~/.screenlayout/home2.sh'
# alias kb='setxkbmap -rules evdev -model pc105 -layout "ro,de" -variant "basic" -option "grp:shift_caps_toggle"'

# tmux
alias tmux="tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf"
alias t="tmux new-session -A -s id"

# dmenu stuff
# alias dnm='networkmanager_dmenu'
# alias dbt='dmenu-bluetooth'

# other cli utils
alias pm='pulsemixer'

# locations
alias lab='cd ~/priv/code/lab'
alias own='cd ~/priv/code/own'
alias pixl='aft-mtp-mount ~/priv/pixl'

# cleanup home
alias irssi="irssi --home ${XDG_CONFIG_HOME}/irssi"
alias svn="svn --config-dir ${XDG_CONFIG_HOME}/subversion"
alias wget="wget --hsts-file=$XDG_DATA_HOME/wget-hsts"

# dotfiles
alias stowe="sudo stow -d $HOME/.dotfiles/etc/ -t /etc/"

# ansible
alias ansible-vault='EDITOR=lvim ansible-vault'

# acme
alias acme='acme.sh --home "$XDG_CONFIG_HOME"/acme.sh/'

# vscode
alias code='vscodium --enable-features=UseOzonePlatform --ozone-platform=wayland'

# time sync
alias synctime='echo "time now:" && date && sudo systemctl stop ntpd && sudo ntpd -gq && sudo systemctl start ntpd && echo "new time:" && date'

# nordvpn
alias nvro='sudo systemctl start nordvpnd && nordvpn c ro && nordvpn whitelist add subnet 10.0.0.0/8 && nordvpn set dns 10.10.10.10'
alias nvdown='nordvpn d && sudo systemctl stop nordvpnd'

# work
alias vpnup='nmcli con up vpn-work --ask'
alias vpndown='nmcli con down vpn-work'
alias vpn='nmcli con down vpn-work; nmcli con up vpn-work --ask'
alias vault-connect='source $HOME/work/secrets/vault.work'
alias terraform-connect='source $HOME/work/secrets/terraform.work'
alias teamsx='killall -15 teams'
alias adm='sudo mount /home/$HOME/work/adm'
alias mongo='ssh -L \*:27777:appserver:27017 jumphost'

Good to see someone else using trash & bat. Kudos for the clean alias file w/ commented headers too! I just started doing it recently and it makes edits/additions so much easier

Thanks. It's not the prettiest, but I try to keep an order of some kind... My zshrc was getting quite large, so I split it and when I did that I also put in some comments and headers.

Using trash is good... aliasing it to rm, maybe not so good

Care to elaborate?

For me, it once caused an issue once when I thought I was deleting files to make space for /boot/efi/ being at capacity (dual booting issues at the time) when in actuality I was just moving files to an impromptu trash can created on /boot/efi (so the lack of space remained the same lol), but on numerous occasions, it has actually saved my ass and allowed me to retrieve documents that I realized I needed to look at again.

The only other quirk is it straight up ignores all options, so I've tried to delete interactively (rm -i) and then had to use trash-list to view the deleted files

Maybe I'm being a little paranoid, but I DID accidentally delete a few directories with dotenvs in them, which is what led me to find trash in the first place. That experience really traumatized me... so to break the rm habit and make sure I don't do that on ANY computer I set up abbr rm '# Don\'t use this! Use trash-cli instead' # and abbr t trash.

I try to keep backups of almost everything, so even if I accidentally delete something and only notice after a clear the trash, there is still a chance I will recover the missing pieces.