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 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 "
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/
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…
Call me weird, I don’t have any.
Me either. I do a lot of initial setup for customer sites. Don’t want to get too used to customized shells or tmux.
here we go, in no particular order:
claer=clear gvim='nvim +Gclog +Git' vim=nvim vi=/usr/bin/vim v=/usr/bin/vi glog='git log --oneline --graph --all' rcp='rsync -r --info=progress2 --partial' d0='du -h --max-depth 0' d1='du -h --max-depth 1' ls='ls --time-style=long-iso --color=tty' icat=chafa ssh='TERM=xterm-256color ssh' # (kitty messes with TERM)
I’m stealing claer
I can’t spell when typing fast :P
control+l
is much easier
A bit long, but here goes:
Start gomuks Matrix Client
alias gomuks=/home/craig/.local/bin/gomuks-linux-arm64
walk: Terminal File Manager
https://github.com/antonmedv/walk
alias walk=“walk --icons”
Weather:https://github.com/chubin/wttr.in
alias weather=“/home/craig/.local/bin/weather.sh”
Onelinershell https://github.com/Onelinerhub/shellhub
alias oh=“/home/craig/.local/bin/oh.sh”
Show open ports
alias ports=‘sudo netstat -tulanp’
Refresh .bashrc
alias bashrc=“source ~/.bashrc”
become root
alias root=‘sudo -i’ alias su=‘sudo su’
Fix which
alias which=‘command -v’
APT User Commands
alias search=‘apt search’ alias file=‘apt-file search’ alias policy=‘apt policy’ alias show=“nala show”
if user is not root, pass all commands via sudo
if [ $UID -ne 0 ]; then alias update=‘sudo apt update’ alias ainstall=‘sudo apt install’ alias apurge=‘sudo apt purge -y --autoremove’ alias upgrade=‘sudo nala upgrade’ alias aremove=‘sudo apt autoremove -y’ alias clean=‘sudo nala clean’ alias reboot=‘sudo reboot’ alias shutdown=“sudo shutdown -P now” fi
Handy-dandy aliases for journalctl and systemctl
alias jc=‘sudo journalctl -b’ alias jca=‘sudo journalctl’ alias jcf=‘sudo journalctl -f’ alias jcr=‘sudo journalctl --list-boots’ alias sc=‘sudo systemctl’
Making files immortal & executable
alias im+=“sudo chattr +i” alias im-=“sudo chattr -i” alias exe=“sudo chmod +x”
#Add safety nets
do not delete / or prompt if deleting more than 3 files at a time
alias rm=‘rm -I --preserve-root’
confirmation
alias mv=‘mv -i’ alias cp=‘cp -i’ alias ln=‘ln -i’
Parenting changing perms on /
alias chown=‘chown --preserve-root’ alias chmod=‘chmod --preserve-root’ alias chgrp=‘chgrp --preserve-root’
copy the current working directory to the clipboard
alias cpwd=‘pwd | xclip -selection clipboard’
Clipboard
alias cpy=“xclip -selection clipboard”
quick directory movement
alias …=‘cd …’ alias …=‘cd …/…’ alias …=‘cd …/…/…’
go to the last directory you were in
alias back=‘cd $OLDPWD’
quickly find files and directory
alias ff=‘find . -type f -name’ alias fd=‘find . -type d -name’
Create Python virtual environment
alias ve=‘python3 -m venv ./venv’ alias va=‘source ./venv/bin/activate’
Ping Commands
Stop after sending count ECHO_REQUEST packets
alias ping=‘ping -c 5’ alias pg=“ping google.com -c 5”
alias shortcuts
alias rpi=“sudo rpi-update” alias rpi-next=“sudo BRANCH=next rpi-update” alias raspi=“sudo raspi-config” alias clr=“clear” alias clrh=“history -c -w ~/.bash_history” alias df=‘df -H’ alias du=‘du -ch’ alias mk=“mkdir -p” alias loading=“sudo dmesg > ~/dmesg.txt”
ls Commands
Colorize the ls output and human readable sizes
alias ls=‘ls --color=auto --human-readable -al’
Use a long listing format
alias ll=‘ls -la’
Show hidden files
alias l.=‘ls -d .* --color=auto’
Listing files in folder
alias listkb=“ls -l --block-size=K” alias listmb=“ls -l --block-size=M”
Colorize the grep command output for ease of use (good for log files)##
alias grep=‘grep --color=auto’ alias egrep=‘egrep --color=auto’ alias fgrep=‘fgrep --color=auto’
Colorize diff output
alias diff=‘colordiff’
Start calculator with math support
alias bc=“bc -l”
Resume wget by default
alias wget=“wget -c”
ps Commands
alias ps=“ps auxf”
Get top process eating cpu
alias pscpu=“ps auxf | sort -nr -k 3” alias pscpu10=“ps auxf | sort -nr -k 3 | head -10”
Get top process eating memory
alias psmem=‘ps auxf | sort -nr -k 4’ alias psmem10=‘ps auxf | sort -nr -k 4 | head -10’
Free and Used Ram
alias meminfo=‘free -l’ alias free=‘free -mt’
Run top in alternate screen
alias top=‘tput smcup; top; tput rmcup’
i wanna see u try use a vanilla profile
The struggle I sometimes face when I SSH into somewhere, lol! Fortunately, there’s a lot of differences that it’s easy realize that “this is a different machine”, and I just open a different terminal tab/window to look up the pure command versions if I need to.
deleted by creator
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 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'
alias hgrep='function _f(){ history | grep $1; };_f'
Because I’m to lazy to type
history | grep whatever_I'm_looking_for
alias rpmfind='rpm -qa | grep'
OMG. I originally got the impression (from somewhere) that you couldn’t pass arguments to an alias, so I googled and found that weird function nonsense. Oh well, live and learn. Thanks.
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
I also use
alias nd=nix develop
a lot.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
For system updates:
[ -r /etc/os-release ] && . /etc/os-release case "$ID" in arch|archarm) if which paru > /dev/null 2>&1; then alias updates='echo Using paru; paru' else alias updates='echo Using pacman; sudo pacman -Syu --noconfirm' fi ;; debian|ubuntu) alias updates='echo Using apt dist-upgrade; sudo apt update && sudo apt dist-upgrade -y' ;; esac
I have a similar one but I did it this way:
function ins { PACKAGE="${1}" exists() { command -v "$1" >/dev/null 2>&1 } if exists dnf; then #Fedora sudo dnf update && sudo dnf install -y $PACKAGE elif exists apt; then #Debian sudo apt update && sudo apt install -y $PACKAGE elif exists apk; then #Alpine apk -U upgrade && apk add $PACKAGE elif exists emerge; then #Gentoo sudo emerge $PACKAGE elif exists zypper; then #Suse sudo zypper ref && sudo zypper install $PACKAGE elif exists pacman; then #Arch pacman -S $PACKAGE elif exists brew; then #MacOS brew install $PACKAGE else echo "Error can't install package $PACKAGE. No package manager is detected." exit 1; fi }
Actually that’s the install one. Here’s the upgrade one:
function upg { exists() { command -v "$1" >/dev/null 2>&1 } if exists dnf; then #Fedora sudo dnf update && sudo dnf -y upgrade && sudo dnf -y autoremove elif exists apt; then #Debian sudo apt update && sudo apt full-upgrade -y elif exists apk; then #Alpine apk -U upgrade elif exists emerge; then #Gentoo sudo emerge --ask --verbose --update --deep --newuse @world && sudo emerge --ask --verbose --depclean elif exists zypper; then #Suse sudo zypper ref && sudo zypper update elif exists pacman; then #Arch pacman -Syu elif exists brew; then #MacOS brew update && brew upgrade else echo "Error: cannot update packages. No package manager is detected." exit 1; fi if exists snap; then #Snaps sudo snap refresh fi if exists flatpak; then #Flatpak flatpak update -y fi }
Very nice
I Alias “sudo !!” with “plz”
For me it’s stfu
alias getmp4="yt-dlp -f 'bestvideo+bestaudio[ext=m4a]/best[ext=mp4]' --recode-video mp4" alias getmp3="yt-dlp -x --audio-format mp3" alias downloadwebsite="wget -mkEpnp" flushall () { sudo pacman -Scc sudo pacman -Rns $(pacman -Qdtq) flatpak uninstall --unused } updateall () { yay flatpak update while read -p "Clear cache and uninstall orphans? (y/N)" answer do case $answer in ([yY][eE][sS] | [yY]) flushall;; (*) break;; esac done }
Some QoL stuff my good friend set-up for me.
# ALIASES -- EXA alias ls='exa --group-directories-first --color=auto -h -aa -l --git' # ALIASES -- YAY alias yy='yay -Y --needed --norebuild --nocleanafter --nodiffmenu --noredownload --nocleanmenu --removemake --sudoloop' alias ya='yay -S --needed --norebuild --nocleanafter --nodiffmenu --noredownload --nocleanmenu --removemake --sudoloop' alias yu='yay -R --recursive --nosave' # ALIASES -- CP alias cp="cp --reflink=auto -i"
And then there’s a bunch of stuff from the output of
alias
, most of them are git aliases. Those which aren’t git-related are listed below:-='cd -' ...=../.. ....=../../.. .....=../../../.. ......=../../../../.. 1='cd -1' 2='cd -2' 3='cd -3' 4='cd -4' 5='cd -5' 6='cd -6' 7='cd -7' 8='cd -8' 9='cd -9' _='sudo ' cp='cp --reflink=auto -i' egrep='grep -E --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}' fgrep='grep -F --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}' history=omz_history l='ls -lah' la='ls -lAh' ll='ls -lh' ls='exa --group-directories-first --color=auto -h -aa -l --git' lsa='ls -lah' md='mkdir -p' rd=rmdir run-help=man which-command=whence
Good to see another exa user. Care to break down what yay does btw?
Ah, yay is an AUR helper, though I personally see it as a
pacman
helper as well. Link here. Some of the flags and options that can be used forpacman
can be used foryay
, thus, some of the flags in the aliases I use are actually forpacman
. Anyways, on to the breakdown.alias yy='yay -Y --needed --norebuild --nocleanafter --nodiffmenu --noredownload --nocleanmenu --removemake --sudoloop'
This one is what I use to look up for packages. The result of runnning
yy «search term»
would be a list of packages matching the search term and prompting the user on which package(s) to install.flag description -Y
performs yay-specific operations. --needed
(pacman) do not reinstall up to date packages --norebuild
skips package build if in cache and up to date --nocleanafter
do not remove package sources after successful build --noredownlod
skip pkgbuild download if in cache and up to date --nodiffmenu
don’t show diffs for build files --nocleanmenu
don’t clean build PKGBUILDS --removemake
remove makedepends after install --sudoloop
loop sudo calls in the background to avoid timeout alias ya='yay -S --needed --norebuild --nocleanafter --nodiffmenu --noredownload --nocleanmenu --removemake --sudoloop'
This one is what I use for installing packages. Useful if I already know what package I would be installing.
flag description -S
(pacman, extended by Yay to cover AUR as well) Synchronize packages. Packages are installed directly from the remote repositories, including all dependencies required to run the packages. alias yu='yay -R --recursive --nosave'
This one is what I use when uninstalling packages. I usually check the package name with something like
yay -Qi «package-name-guess»
beforehand.flag description -R
(pacman, extended by Yay to also remove cached data about devel packages) Remove package(s) from the system. --recursive
(pacman) Remove each target specified including all of their dependencies, provided that (A) they are not required by other packages; and (B) they were not explicitly installed by the user. This operation is recurisve and analogous to a backwards --sync
operation.--nosave
(pacman) Instructs pacman
to ignore file backup designations. (This avoids the removed files being renamed with a.pacsave
extension.)I actually don’t know much about both
yay
andpacman
myself, since the aliases were just passed onto me by the same friend who helped me (re-)install my system (long story) and set-up the aliases. Having looked all these up, however, I might make a few changes (like changing the--nocleanafter
and--nocleanmenu
options to their clean ones`).
I like the idea of binding numbers to parent directory traversal. I do cd …/… a lot in one of my projects (switching between source code and terraform folder), it’d be handy to get out of the terraform folder by just typing
2
.I actually would do
cd ..
and then do apwd
(and so on, repeatedly) because I often get confused and have a very short attention span that the aliases ended up unused.