There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

SHARE WITH THE CLASS: What aliases are you using?

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

macallik OP ,

Some random ones I created over the last week or so:

alias clipboard='xclip -selection clipboard' # Allows me to pipe output directly to my keyboard. good for pwd for example.

Function allows me to get tldr and cheat responses to commands quickly
function cht() {
curl cheat.sh/$1
}

Easy calculator so that I can do math w/o launching a specific app
function calc() {
echo "scale=3; $@" | bc
}

gamma ,
@gamma@programming.dev avatar

(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:


<span style="color:#323232;"># Simple python calculator
</span><span style="color:#323232;">alias pycalc='python3 -ic "
</span><span style="color:#323232;">from math import *nimport cmath as C
</span><span style="color:#323232;">try:
</span><span style="color:#323232;">    import numpy as np
</span><span style="color:#323232;">except:
</span><span style="color:#323232;">    pass
</span><span style="color:#323232;">i, j = 1j, 1j
</span><span style="color:#323232;">"'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Defaults
</span><span style="color:#323232;">alias cp='cp --interactive --reflink=auto'
</span><span style="color:#323232;">alias gcc='gcc -fdiagnostics-color=auto'
</span><span style="color:#323232;"># Lemmy doesn't handle ampersands in codeblocks correctly
</span><span style="color:#323232;">alias rg='rg --max-columns=$((COLUMNS > 60 &amp;&amp; ! ZSH_SUBSHELL ? COLUMNS - 30 : 0))'
</span><span style="color:#323232;">alias rj='rg --json'
</span><span style="color:#323232;">alias rm='rm -s'
</span><span style="color:#323232;">alias rscp='rsync -azP --human-readable --info=flist0,progress2,stats1'
</span><span style="color:#323232;">alias rust-c='rustc --out-dir build -O'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Shorter forms
</span><span style="color:#323232;">alias g=git
</span><span style="color:#323232;">alias v=$VISUAL
</span><span style="color:#323232;">alias py=python
</span><span style="color:#323232;">alias jfeu='journalctl --user -xfeu'
</span><span style="color:#323232;">alias sys='systemctl --user'
</span><span style="color:#323232;">alias Jfeu='journalctl -xfeu'
</span><span style="color:#323232;">alias Sys=systemctl
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Desktop stuff
</span><span style="color:#323232;">alias trash='gio trash'
</span><span style="color:#323232;">alias ud=udisksctl
</span><span style="color:#323232;">alias y=wl-copy
</span><span style="color:#323232;">alias Y='wl-copy -p'
</span><span style="color:#323232;">alias p=wl-paste
</span><span style="color:#323232;">alias P='wl-paste -p'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Colorize with acolor/grc
</span><span style="color:#323232;">alias GRC='grc -es'
</span><span style="color:#323232;">alias LA='acol ls -lFAhb --color'
</span><span style="color:#323232;">alias LS='acol ls -lFhb --color'
</span><span style="color:#323232;">alias df='GRC df -hT'
</span><span style="color:#323232;">alias dig='GRC dig'
</span><span style="color:#323232;">alias docker='GRC docker'
</span><span style="color:#323232;">alias docker-machine='GRC docker-machine'
</span><span style="color:#323232;">alias env='acol env'
</span><span style="color:#323232;">alias lsblk='acol lsblk'
</span><span style="color:#323232;">alias lsmount='command mount | rg --color=never "^/" | acol -i -o mount'
</span><span style="color:#323232;">alias lspci='acol lspci'
</span><span style="color:#323232;">alias mount='acol mount'
</span><span style="color:#323232;">alias nmap='acol nmap'
</span><span style="color:#323232;">alias ping='GRC ping'
</span><span style="color:#323232;">alias ps='GRC ps --columns $COLUMNS'
</span><span style="color:#323232;">alias traceroute='GRC traceroute'
</span>
mojo ,

alias upgrade=“sudo dnf upgrade --yes &amp;&amp; flatpak update &amp;&amp; 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.

turing_spider574 ,

alias nano=‘nano -l’

my only one, to have line numbers when searching for errors in log files

Exec ,
@Exec@pawb.social avatar

Copying multiple lines will be more difficult. You can use Ctrl+C to display the current position, use page up/down for coarse navigation.

craigevil ,
@craigevil@lemmy.ml avatar

A bit long, but here goes:

Start gomuks Matrix Client

alias gomuks=/home/craig/.local/bin/gomuks-linux-arm64

walk: Terminal File Manager

github.com/antonmedv/walk

alias walk=“walk --icons"

Weather:github.com/chubin/wttr.in

alias weather=”/home/craig/.local/bin/weather.sh"

Onelinershell 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”

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’

aes ,

i wanna see u try use a vanilla profile

megane_kun ,

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.

milkjug ,
@milkjug@beehaw.org avatar

I’m a simple man. I do simple things. I replace df, ls and top with more modern alternatives. Courtesy of this list.


<span style="color:#323232;">alias df="duf"
</span><span style="color:#323232;">alias ls="eza --group-directories-first --long --group --sort=ext --icons --all"
</span><span style="color:#323232;">alias top="btm"
</span>
SGHFan ,
@SGHFan@lemdro.id avatar

Call me weird, I don’t have any.

d00phy ,

Me either. I do a lot of initial setup for customer sites. Don’t want to get too used to customized shells or tmux.

flying_wotsit ,

here we go, in no particular order:


<span style="color:#323232;">claer=clear
</span><span style="color:#323232;">gvim='nvim +Gclog +Git'
</span><span style="color:#323232;">vim=nvim
</span><span style="color:#323232;">vi=/usr/bin/vim
</span><span style="color:#323232;">v=/usr/bin/vi
</span><span style="color:#323232;">glog='git log --oneline --graph --all'
</span><span style="color:#323232;">rcp='rsync -r --info=progress2 --partial'
</span><span style="color:#323232;">d0='du -h --max-depth 0'
</span><span style="color:#323232;">d1='du -h --max-depth 1'
</span><span style="color:#323232;">ls='ls --time-style=long-iso --color=tty'
</span><span style="color:#323232;">icat=chafa
</span><span style="color:#323232;">ssh='TERM=xterm-256color ssh' # (kitty messes with TERM)
</span>
lenathaw ,

I’m stealing claer

Pssk ,
@Pssk@lemmy.ml avatar

control+l is much easier

flying_wotsit ,

I can’t spell when typing fast :P

ExLisper ,

So I’ve checked and…


<span style="color:#323232;">alias la='ls -a'
</span><span style="color:#323232;">alias mplayer='mplayer -noautosub -alang en'
</span><span style="color:#323232;">alias ll='ls $LS_OPTIONS -lh'
</span><span style="color:#323232;">alias l='ls $LS_OPTIONS -lAa'
</span><span style="color:#323232;">alias x='startx'
</span><span style="color:#323232;">alias ekgi='ekg -i'
</span><span style="color:#323232;">alias glinks='links2 -g'
</span>

My god, this must be in my .bashrc since forever. I mean… links2? ekg? startx? It’s like archeology.

I will keep it there for future historians.

deo ,

I will keep it there for future historians.

great, now i have spit coffee all over the place. thanks for the laugh!

backhdlp ,
@backhdlp@lemmy.blahaj.zone avatar

Don’t really organize my aliases after making them, so this might be a mess.


<span style="color:#323232;">##################
</span><span style="color:#323232;">#   ~/.aliases   #
</span><span style="color:#323232;">##################
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Colours
</span><span style="color:#323232;">alias color-GREEN='tput setaf 2'
</span><span style="color:#323232;">alias color-RED='tput setaf 1'
</span><span style="color:#323232;">alias color-CYAN='tput setaf 78'
</span><span style="color:#323232;">alias color-PURPLE='tput setaf 128'
</span><span style="color:#323232;">#alias color-BLUE='tput setaf 4'
</span><span style="color:#323232;">alias color-RESET='tput sgr0'
</span><span style="color:#323232;">alias color-LIGHT_PURPLE='tput setaf 5'
</span><span style="color:#323232;">alias color-LIGHT_BLUE='tput setaf 12'
</span><span style="color:#323232;">alias color-TEXT='tput setaf 15'
</span><span style="color:#323232;">alias color-HIDDEN='tput setaf 236'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># don't set a shutdown timer
</span><span style="color:#323232;">alias shutdown='shutdown now'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># grep
</span><span style="color:#323232;">alias grep='grep --color=auto'
</span><span style="color:#323232;">alias pgrep='pgrep -l'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># package manager
</span><span style="color:#323232;">alias pacman='sudo pacman --color=auto'
</span><span style="color:#323232;">alias paru='paru --color=auto'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># ls
</span><span style="color:#323232;">alias ls='eza -aMF --hyperlink --group-directories-first --icons --color=auto'
</span><span style="color:#323232;">alias ll='eza -alhMF@ --hyperlink --group-directories-first --icons --color=auto --color-scale'
</span><span style="color:#323232;">alias lg='eza -alhMF@ --hyperlink --group-directories-first --icons --git --git-repos --git-ignore --color=auto --color-scale'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># confirm before overwriting
</span><span style="color:#323232;">alias cp='cp -i'
</span><span style="color:#323232;">alias mv='mv -i'
</span><span style="color:#323232;">alias rm='rm -i'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># update grub.cfg
</span><span style="color:#323232;">alias grub-update='sudo grub-mkconfig -o /boot/grub/grub.cfg'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># update function
</span><span style="color:#323232;">u() {
</span><span style="color:#323232;">	# update distro specific packages
</span><span style="color:#323232;">	if command -v pacman &amp;> /dev/null
</span><span style="color:#323232;">	then
</span><span style="color:#323232;">		# update pacman packages
</span><span style="color:#323232;">		printf "n[Update] Updating Standard Packages:nn"
</span><span style="color:#323232;">		sudo pacman -Syu --color=auto
</span><span style="color:#323232;">		# update aur packages
</span><span style="color:#323232;">		if command -v paru &amp;> /dev/null
</span><span style="color:#323232;">		then
</span><span style="color:#323232;">			printf "n[Uodate] Updating AUR Packages:nn"
</span><span style="color:#323232;">			paru -Sau --color=auto
</span><span style="color:#323232;">		fi
</span><span style="color:#323232;">	elif command -v apt &amp;> /dev/null
</span><span style="color:#323232;"> 	then
</span><span style="color:#323232;">		# update apt packages
</span><span style="color:#323232;">		printf "n[Update] Updating Standard Packages:nn"
</span><span style="color:#323232;">		sudo apt-get update
</span><span style="color:#323232;">		sudo apt-get upgrade
</span><span style="color:#323232;">	fi
</span><span style="color:#323232;">	# update flatpaks
</span><span style="color:#323232;">	if command -v flatpak &amp;> /dev/null
</span><span style="color:#323232;">	then
</span><span style="color:#323232;">		printf "n[Update] Updating flatpaks:nn"
</span><span style="color:#323232;">		flatpak update
</span><span style="color:#323232;">	fi
</span><span style="color:#323232;">	# todo:
</span><span style="color:#323232;">	# - update grub
</span><span style="color:#323232;">	# - source shell config
</span><span style="color:#323232;">	printf "n[Update] Donen"
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;"># view metadata
</span><span style="color:#323232;">alias meta='exiftool'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># makepkg dependencies and install
</span><span style="color:#323232;">alias makepkg='makepkg -si'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># git
</span><span style="color:#323232;">alias gc='git clone'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># quick probe
</span><span style="color:#323232;">alias probe='sudo -E hw-probe -all -upload -show -verbose'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># shorten pacman commands
</span><span style="color:#323232;">alias pm='pacman'
</span><span style="color:#323232;">alias pms='pm -Syu'
</span><span style="color:#323232;">alias pmr='pm -Rns'
</span><span style="color:#323232;">alias pmq='pm -Q'
</span><span style="color:#323232;">alias pmu='pm -U'
</span><span style="color:#323232;">alias pmd='sudo downgrade'
</span><span style="color:#323232;">alias pmc='sudo paccache'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># rm pacman lock
</span><span style="color:#323232;">alias rmpml='sudo rm /var/lib/pacman/db.lck'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># quick access to configs
</span><span style="color:#323232;">alias brc='$EDITOR ~/.bashrc'
</span><span style="color:#323232;">alias bash='exec bash'
</span><span style="color:#323232;">alias zrc='$EDITOR ~/.zshrc'
</span><span style="color:#323232;">alias zsh='exec zsh'
</span><span style="color:#323232;">alias alia='$EDITOR ~/.aliases'
</span><span style="color:#323232;">alias expo='$EDITOR ~/.exports'
</span><span style="color:#323232;">alias swayc='$EDITOR ~/.config/sway/config'
</span><span style="color:#323232;">#alias alac-conf='$EDITOR ~/.config/alacritty/alacritty.yml'
</span><span style="color:#323232;">alias starc='$EDITOR ~/.config/starship.toml'
</span><span style="color:#323232;">alias kittc='$EDITOR ~/.config/kitty/kitty.conf'
</span><span style="color:#323232;">alias nvimc='$EDITOR ~/.config/nvim/init.vim'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># alias fetch scripts with hyfetch during pride month
</span><span style="color:#323232;">[[ $(date +'%b') == "Jun" ]] &amp;&amp; alias neofetch='hyfetch -b neofetch'
</span><span style="color:#323232;">[[ $(date +'%b') == "Jun" ]] &amp;&amp; alias fastfetch='hyfetch -b fastfetch'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># use fastfetch backend for hyfetch
</span><span style="color:#323232;">alias hyfetch='hyfetch -b fastfetch'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># add sudo
</span><span style="color:#323232;">alias docker='sudo docker'
</span><span style="color:#323232;">alias systemctl='sudo systemctl'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># systemd
</span><span style="color:#323232;">alias sc='systemctl'
</span><span style="color:#323232;">alias sce='sc enable'
</span><span style="color:#323232;">alias scd='sc disable'
</span><span style="color:#323232;">alias scs='sc start'
</span><span style="color:#323232;">alias scu='sc stop' # the u comes from unset
</span><span style="color:#323232;">alias scr='sc restart'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># yt-dlp
</span><span style="color:#323232;">alias ytm='yt-dlp -x -o "~/Music/%(title)s.%(ext)s" --add-metadata --embed-thumbnail --audio-quality 0'
</span><span style="color:#323232;">alias ytv='yt-dlp -o "~/Videos/%(title)s.%(ext)s" --add-metadata --embed-thumbnail --embed-subs --embed-chapters'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># edit quicker
</span><span style="color:#323232;">alias e='$EDITOR'
</span><span style="color:#323232;">alias se='sudoedit'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># ryujinx (created by pinejinx)
</span><span style="color:#323232;">alias ryu="AMD_DEBUG=w32ge,w32cs,nohyperz,nofmask glsl_zero_init=true radeonsi_clamp_div_by_zero=true force_integer_tex_nearest=true mesa_glthread=false vblank_mode=0 RADV_PERFTEST=bolist gamemoderun DOTNET_EnableAlternateStackCheck=1 GDK_BACKEND=x11 /home/luna/.local/share/Ryujinx/Ryujinx"
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Vencord
</span><span style="color:#323232;">alias inven="sudo VencordInstallerCli-linux -install &amp;&amp; sudo VencordInstallerCli-linux -install-openasar"
</span><span style="color:#323232;">alias unven="sudo VencordInstallerCli-linux -uninstall &amp;&amp; sudo VencordInstallerCli-linux -uninstall-openasar"
</span><span style="color:#323232;">
</span><span style="color:#323232;"># bun > npm
</span><span style="color:#323232;">alias npm='bun'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># replace cat
</span><span style="color:#323232;">alias cat='bat'
</span><span style="color:#323232;">
</span><span style="color:#323232;"># sudo
</span><span style="color:#323232;">alias s='sudo'
</span>
macallik OP ,

Gonna steal/repurpose the shutdown one, use the "sudo docker" = "docker" one and also the grub one. Good lord @ all the configs you edit lol.

reddit_sux ,

I agree pms is a pain especially if it is delayed for more than a month.

learnbyexample ,
@learnbyexample@programming.dev avatar

<span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">a</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">'alias'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a c=</span><span style="color:#183691;">'clear'
</span><span style="color:#323232;">a p=</span><span style="color:#183691;">'pwd'
</span><span style="color:#323232;">a e=</span><span style="color:#183691;">'exit'
</span><span style="color:#323232;">a q=</span><span style="color:#183691;">'exit'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a h=</span><span style="color:#183691;">'history | tail -n20'
</span><span style="font-style:italic;color:#969896;"># turn off history, use 'set -o history' to turn it on again
</span><span style="color:#323232;">a so=</span><span style="color:#183691;">'set +o history'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a b1=</span><span style="color:#183691;">'cd ../'
</span><span style="color:#323232;">a b2=</span><span style="color:#183691;">'cd ../../'
</span><span style="color:#323232;">a b3=</span><span style="color:#183691;">'cd ../../../'
</span><span style="color:#323232;">a b4=</span><span style="color:#183691;">'cd ../../../../'
</span><span style="color:#323232;">a b5=</span><span style="color:#183691;">'cd ../../../../../'
</span><span style="color:#323232;">
</span><span style="color:#323232;">a ls=</span><span style="color:#183691;">'ls --color=auto'
</span><span style="color:#323232;">a l=</span><span style="color:#183691;">'ls -ltrhG'
</span><span style="color:#323232;">a la=</span><span style="color:#183691;">'l -A'
</span><span style="color:#323232;">a vi=</span><span style="color:#183691;">'gvim'
</span><span style="color:#323232;">a grep=</span><span style="color:#183691;">'grep --color=auto'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># open and source aliases
</span><span style="color:#323232;">a oa=</span><span style="color:#183691;">'vi ~/.bash_aliases'
</span><span style="color:#323232;">a sa=</span><span style="color:#183691;">'source ~/.bash_aliases'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># sort file/directory sizes in current directory in human readable format
</span><span style="color:#323232;">a s=</span><span style="color:#183691;">'du -sh -- * | sort -h'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># save last command from history to a file
</span><span style="font-style:italic;color:#969896;"># tip, add a comment to end of command before saving, ex: ls --color=auto # colored ls output
</span><span style="color:#323232;">a sl=</span><span style="color:#183691;">'fc -ln -1 | sed "s/^s*//" >> ~/.saved_commands.txt'
</span><span style="font-style:italic;color:#969896;"># short-cut to grep that file
</span><span style="color:#323232;">a slg=</span><span style="color:#183691;">'&lt; ~/.saved_commands.txt grep'
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># change ascii alphabets to unicode bold characters
</span><span style="color:#323232;">a ascii2bold=</span><span style="color:#183691;">"perl -Mopen=locale -Mutf8 -pe 'tr/a-zA-Z/𝗮-𝘇𝗔-𝗭/'"
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;">### functions
</span><span style="font-style:italic;color:#969896;"># 'command help' for command name and single option - ex: ch ls -A
</span><span style="font-style:italic;color:#969896;"># see https://github.com/learnbyexample/command_help for a better script version
</span><span style="font-weight:bold;color:#795da3;">ch</span><span style="color:#323232;">() { whatis $1</span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">man $1 </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">sed -n </span><span style="color:#183691;">"/^s*$</span><span style="color:#323232;">2</span><span style="color:#183691;">/,/^$/p" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># add path to filename(s)
</span><span style="font-style:italic;color:#969896;"># usage: ap file1 file2 etc
</span><span style="font-weight:bold;color:#795da3;">ap</span><span style="color:#323232;">() { </span><span style="font-weight:bold;color:#a71d5d;">for</span><span style="color:#323232;"> f </span><span style="font-weight:bold;color:#a71d5d;">in </span><span style="color:#183691;">"$</span><span style="color:#323232;">@</span><span style="color:#183691;">"</span><span style="font-weight:bold;color:#a71d5d;">; do </span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"$</span><span style="color:#323232;">PWD</span><span style="color:#183691;">/$</span><span style="color:#323232;">f</span><span style="color:#183691;">"</span><span style="font-weight:bold;color:#a71d5d;">; done; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># simple case-insensitive file search based on name
</span><span style="font-style:italic;color:#969896;"># usage: fs name
</span><span style="font-style:italic;color:#969896;"># remove '-type f' if you want to match directories as well
</span><span style="font-weight:bold;color:#795da3;">fs</span><span style="color:#323232;">() { find -type f -iname </span><span style="color:#183691;">'*'"$</span><span style="color:#323232;">1</span><span style="color:#183691;">"'*' </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># open files with default application, don't print output/error messages
</span><span style="font-style:italic;color:#969896;"># useful for opening docs, pdfs, images, etc from command line
</span><span style="font-weight:bold;color:#795da3;">o</span><span style="color:#323232;">() { xdg-open </span><span style="color:#183691;">"$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">&</span><span style="color:#323232;">amp</span><span style="font-weight:bold;color:#a71d5d;">;></span><span style="color:#323232;"> /dev/null </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="font-style:italic;color:#969896;"># if unix2dos and dos2unix commands aren't available by default
</span><span style="font-weight:bold;color:#795da3;">unix2dos</span><span style="color:#323232;">() { sed -i </span><span style="color:#183691;">'s/$/r/' "$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span><span style="font-weight:bold;color:#795da3;">dos2unix</span><span style="color:#323232;">() { sed -i </span><span style="color:#183691;">'s/r$//' "$</span><span style="color:#323232;">@</span><span style="color:#183691;">" </span><span style="font-weight:bold;color:#a71d5d;">; </span><span style="color:#323232;">}
</span>
noughtnaut ,

What do you use the ascii to bold function for?

learnbyexample ,
@learnbyexample@programming.dev avatar

I used to use it for posting on Twitter, with some keywords (like book title) in bold.

mysticallego ,

My favorite one: alias upgrate=“sudo apt update && sudo apt upgrade”

macallik OP ,

ahhh a pormanteau lol, I like it

darcy ,
@darcy@sh.itjust.works avatar

vim grindset 💪


<span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">q</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">exit
</span><span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">:q</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">exit
</span><span style="color:#62a35c;">alias </span><span style="font-weight:bold;color:#795da3;">:wq</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">exit
</span>
PseudoSpock ,
@PseudoSpock@lemmy.dbzer0.com avatar

alias .=exit

gamma ,
@gamma@programming.dev avatar

That would make my shell unusable, since some plugins use ./source.

PseudoSpock ,
@PseudoSpock@lemmy.dbzer0.com avatar

./ and . Are two different things to your shell

gamma ,
@gamma@programming.dev avatar

I know; I’m not talking about ./. I put the slash outside the inline codeblock in the parent comment.

My shell is setup with a chdir hook to [[ -r. /.autoenv.zsh ]] &amp;&amp; . ./.autoenv.zsh.

(Edit: Jerboa is bugged with “&” in codeblocks, that should be a “&&”, not &amp;&amp;)

PseudoSpock ,
@PseudoSpock@lemmy.dbzer0.com avatar

Ah, ok. For me it was an alias common in the university labs back on Ultrix. Became a habit way back then.

alper_celik ,

I have :q to exit too since i was trying to exit shell with :q. I guess (n)vim users cant exit their shells :)

darcy ,
@darcy@sh.itjust.works avatar

we spent so much time learning to exit vim, we forgot how to exit shell 😔

Krafting ,
@Krafting@lemmy.world avatar

ussr

For connecting as root with a private key on my main server named Undine Sous Speed.

macallik OP ,

The best alliases are little inside jokes that are easy to remember imo

Klaymore ,
@Klaymore@sh.itjust.works avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines