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
alias upgrade="sudo dnf upgrade --yes && flatpak update && flatpak remove --unused"
Or something like that, also a dnf remove unused command in there. Writing this from my phone so might be written wrong.
(NOTE: A lot of my more interesting “aliases” are actually short functions, but I’m keeping myself to
alias
.)Some of mine that I haven’t seen yet:
# Simple python calculator alias pycalc='python3 -ic " from math import *\nimport cmath as C try: import numpy as np except: pass i, j = 1j, 1j "' # Defaults alias cp='cp --interactive --reflink=auto' alias gcc='gcc -fdiagnostics-color=auto' # Lemmy doesn't handle ampersands in codeblocks correctly alias rg='rg --max-columns=$((COLUMNS > 60 && ! ZSH_SUBSHELL ? COLUMNS - 30 : 0))' alias rj='rg --json' alias rm='rm -s' alias rscp='rsync -azP --human-readable --info=flist0,progress2,stats1' alias rust-c='rustc --out-dir build -O' # Shorter forms alias g=git alias v=$VISUAL alias py=python alias jfeu='journalctl --user -xfeu' alias sys='systemctl --user' alias Jfeu='journalctl -xfeu' alias Sys=systemctl # Desktop stuff alias trash='gio trash' alias ud=udisksctl alias y=wl-copy alias Y='wl-copy -p' alias p=wl-paste alias P='wl-paste -p' # Colorize with acolor/grc alias GRC='grc -es' alias LA='acol ls -lFAhb --color' alias LS='acol ls -lFhb --color' alias df='GRC df -hT' alias dig='GRC dig' alias docker='GRC docker' alias docker-machine='GRC docker-machine' alias env='acol env' alias lsblk='acol lsblk' alias lsmount='command mount | rg --color=never "^/" | acol -i -o mount' alias lspci='acol lspci' alias mount='acol mount' alias nmap='acol nmap' alias ping='GRC ping' alias ps='GRC ps --columns $COLUMNS' alias traceroute='GRC traceroute'
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
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-cliinstead' #
andabbr 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.
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.
deleted by creator
deleted by creator
There is a shell option for this (at least in zsh):
setopt autocd
. This allows you to change directories while omitting the cd in frontThanks for sharing, likely will implement this!
alias nano='nano -l'
my only one, to have line numbers when searching for errors in log files
Copying multiple lines will be more difficult. You can use Ctrl+C to display the current position, use page up/down for coarse navigation.
alias clear="clear; fastfetch"
alias sudo="doas"
alias clr="clear"
alias kx="killall Xwayland"
alias vpython="~/newVenv/bin/python"
alias vpip="~/newVenv/bin/pip"
I just use ^L instead of
clear
.same
alias ls='ls --time-style=long-iso' alias la='ls -alh' alias ncdu='ncdu --color=off' alias wttr='curl wttr.in/?T0' alias vim='vimx' alias ipinfo='curl ipinfo.io --no-progress-meter | jq "del(.readme)"' alias pp="pkill -SIGSTOP -f " alias pc="pkill -SIGCONT -f "
what is vimx just wondering ?
Seems to be just normal vim, maybe some distros packages the binary (of vim with more options enabled at compile time) as vimx so that it doesn’t conflict with another vim package (as an example vim-tiny). https://www.systutorials.com/docs/linux/man/1-vimx/
But only @aram@[email protected], can answer that for us.
vimx support X/Wayland copy paste, using "+y or "+p
Like GVim, but on terminal… haha…
Another wttr user 👏🏾👏🏾👏🏾
wttr gang
Hehe pp
pp = process pause = pkill -f SIGSTOP
I hate when Win10 idle/pause on KVM/QEMU still taking much CPU, and the only way to stop it using pp/pkill…
https://blog.benyamin.xyz/2023/03/11/stop-windows-vm-cpu-usage-while-paused-on-qemu-linux/
Feel free to call me a poser, a scrub, etc but I don’t use aliases (other than the default ones, that is).
Why? Two words:
Brain. Exercise.
Finger. Exercise.
I’ve got a “println” finger reflex now xD
alias a='alias' a c='clear' a p='pwd' a e='exit' a q='exit' a h='history | tail -n20' # turn off history, use 'set -o history' to turn it on again a so='set +o history' a b1='cd ../' a b2='cd ../../' a b3='cd ../../../' a b4='cd ../../../../' a b5='cd ../../../../../' a ls='ls --color=auto' a l='ls -ltrhG' a la='l -A' a vi='gvim' a grep='grep --color=auto' # open and source aliases a oa='vi ~/.bash_aliases' a sa='source ~/.bash_aliases' # sort file/directory sizes in current directory in human readable format a s='du -sh -- * | sort -h' # save last command from history to a file # tip, add a comment to end of command before saving, ex: ls --color=auto # colored ls output a sl='fc -ln -1 | sed "s/^\s*//" >> ~/.saved_commands.txt' # short-cut to grep that file a slg='< ~/.saved_commands.txt grep' # change ascii alphabets to unicode bold characters a ascii2bold="perl -Mopen=locale -Mutf8 -pe 'tr/a-zA-Z/𝗮-𝘇𝗔-𝗭/'" ### functions # 'command help' for command name and single option - ex: ch ls -A # see https://github.com/learnbyexample/command_help for a better script version ch() { whatis $1; man $1 | sed -n "/^\s*$2/,/^$/p" ; } # add path to filename(s) # usage: ap file1 file2 etc ap() { for f in "$@"; do echo "$PWD/$f"; done; } # simple case-insensitive file search based on name # usage: fs name # remove '-type f' if you want to match directories as well fs() { find -type f -iname '*'"$1"'*' ; } # open files with default application, don't print output/error messages # useful for opening docs, pdfs, images, etc from command line o() { xdg-open "$@" &> /dev/null ; } # if unix2dos and dos2unix commands aren't available by default unix2dos() { sed -i 's/$/\r/' "$@" ; } dos2unix() { sed -i 's/\r$//' "$@" ; }
What do you use the ascii to bold function for?
I used to use it for posting on Twitter, with some keywords (like book title) in bold.
What… I didn’t know this was a thing.
So I could make be “sudo gimme-dat-new-new” Instead of “sudo DNF upgrade -y”
alias gimmie-dat-new-new='sudo dnf upgrade -y'
Although you should probably look over your upgrade before applying it as a general good practice. But, hey, I do this myself (dnfup instead of gimmie-dat-etc.), so I can’t talk too much shit.
ETA: If you want it to be a persistent alias, though, you gotta add it to your .bashrc
you can just put “gimme-dat-new-new”
deleted by creator
I’ve got the standard ones (l, ll, ls) to be forms of
ls -flags
df = df -h mv = mv -i rm = rm -i nix-switch = sudo nix-rebuild --switch flake . nix-upd = nix flake update systat = systemctl status sysena = sudo systemctl enable systop = sudo systemctl stop
Digging the systemctl ones. I added myself to the group so that I wouldn’t have to write sudo each time, but I might as well alias the entire prompt for restart and status to make it even shorter
I also use
alias nd=nix develop
a lot.
Discussion and suggestions welcome :)
I appreciate the focus on verbosity. I should probably set more of my defaults to follow the same thought process 🤔