Share your alias AND/OR function

I just read the article about changing the mirrors to https and there were some cool alias(es?) to update the system with a short command.

Maybe someone else has got some cool or useful alias for daily/weekly tasks to be added to the bashrc?
I only got this ones so far:

alias mirror='sudo reflector --verbose --latest 200 --protocol https --sort rate --save /etc/pacman.d/mirrorlist'
alias update='sudo pacman -Syyu'

So there is much room for improvement. :slight_smile:


alias ls=‘ls --color=auto’
alias merge=‘xrdb -merge ~/.Xresources’
alias microcode=‘grep . /sys/devices/system/cpu/vulnerabilities/
alias mirror=‘sudo reflector --protocol https --latest 50 --number 20 --sort rate --save /etc/pacman.d/mirrorlist’
alias mirrors=‘mirror’
alias pacman=‘sudo pacman --color auto’
alias pdw=‘pwd’
alias pksyua=‘yay -Syu --noconfirm’
alias ps=‘ps auxf’
alias psgrep=‘ps aux | grep -v grep | grep -i -e VSZ -e’
alias skel='cp -rf /etc/skel/
alias trizenskip=‘trizen -S --skipinteg’
alias unlock=‘sudo rm /var/lib/pacman/db.lck’
alias update=‘sudo pacman -Syyu’
alias update-grub=‘sudo grub-mkconfig -o /boot/grub/grub.cfg’

1 Like
# Pacman functions
alias s="sudo pacman -S"
alias syy="sudo pacman -Syy"
alias syu="sudo pacman -Syu"
alias syyu="sudo pacman -Syyu"
alias syyuu="sudo pacman -Syyuu"
alias rns="sudo pacman -Rns"
alias rdd="sudo pacman -Rdd"

# Remove and copy recursively
alias rmr="sudo rm -r"
alias cpr="sudo cp -r"

# up and re to "update" and reorder mirrorlist
alias u='sudo haveged -w 1024; sudo pacman-key --init; sudo pacman-key --populate; sudo pacman-key --refresh-keys; sudo pkill haveged; sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak; sudo reflector --verbose --age 8 --fastest 128 --latest 64 --number 32 --sort rate --save /etc/pacman.d/mirrorlist; sudo pacman -Syy'
alias up='sudo pacman-key --init; sudo pacman-key --populate; sudo pacman-key --refresh-keys; sudo pacman -Syy'
alias re='sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak; sudo reflector --verbose --age 8 --fastest 128 --latest 64 --number 32 --sort rate --save /etc/pacman.d/mirrorlist'

I also have some functions like


    # executes xed as text editor
    # syntax pkk <file>

    pkexec xed $WHEREAMI/$1

Thank you for the inspiration. I’ve already saw some entries I’m going to add to my alias. :wink:

Trying to understand the function… it starts the xed (Text-editor?) in your current folder?

I’ll steal most of those, tho I question the need for both Syyu and Syu?

(Running fish so slightly different)

alias mirrors=“sudo reflector --verbose --protocol https --country Germany --country Sweden --latest 20 --sort rate --save /etc/pacman.d/mirrorlist”

funcsave mirrors

alias update=“mirrors && yay -Syyu”

funcsave update

1 Like

I use the AUR helper “pacaur”. There are quite a few AUR helpers and if you are using an Arch based install you would be well advised to read the Arch wiki on them.

AUR helpers

Here are my alias’s,

alias sudo="sudo " #Create an alias for sudo with a space at the end then all other aliases will work with sudo without the need for a password.
alias w7=“sudo mount /dev/nvme0n1p3 /mnt”
alias w7u=“sudo umount /dev/nvme0n1p3”
alias ls=“ls --color=auto”
alias x=“startx”

alias pacu=“pacaur -Syu”
alias paci=“pacaur -S”
alias pacr=“pacaur -Rns”
alias pacq=“pacaur -Q”
alias pacor=“pacaur -Rns $(pacman -Qtdq)” #recursively removing orphans and their configuration files

alias rbs=“firejail --private --dns= --dns= firefox -no-remote”
alias transmission-gtk=“firejail transmission-gtk”

alias gf=“grim-fandango”
alias ha=“hangman”
#alias boa=“flatpak run com.realm667.WolfenDoom_Blade_of_Agony”



I actually use a linked file to hold all my alias’s, mostly because not all apply to Arch because I distro-hop so often.


Clear screen

alias cls=‘clear’
alias more=‘less’
alias “:q”=“exit”

Invoke irssi session within tmux

alias irs=“tmux new -s irssi irssi”


alias sudo='sudo ’
alias kdsu='kdesu dbus-launch ’
alias reboot=‘reboot’
alias poweroff=‘poweroff’
alias halt=‘halt’

Clean python crud

alias pyclean=‘find . -name *.pyc -o -name *.pyo -o -name pycache -delete’


alias pacman=‘sudo pacman --color auto’
alias pacupd=‘pacman -Syy’
alias pacupg=‘pacman -Syyu’
alias pacins='pacman -S ’
alias pacnoc='pacman -S --noconfirm ’
alias pacrem='pacman -R ’
alias pacdep='pacman -Rcn ’
alias pacshq=“pacman -Ql pacman | awk -F”[/ ]" ‘//usr/bin/ {print $5}’"
alias pksyua=“yay -Syyu --noconfirm”
alias editpac=“sudo /opt/sublime_text/sublime_text /etc/pacman.conf”

‘[r]emove [o]rphans’ - recursively remove ALL orphaned packages

alias pacrmo="/usr/bin/pacman -Qtdq > /dev/null && sudo /usr/bin/pacman -Rns $(/usr/bin/pacman -Qtdq | sed -e ‘:a;N;$!ba;s/\n/ /g’)"


alias yayupd=‘yay -Syy’
alias yayupg=‘yay -Syu’
alias yayrem='yay -R ’
alias yayrms='yay -Rs ’
alias yayins='yay -S ’
alias yaynoc='yay -S --noconfirm ’


alias zypdup=‘sudo zypper dup --allow-vendor-change’

reflector update mirrors

alias reflect=“reflector --latest 20 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist”
alias reflectus=“reflector --country ‘United States’ --latest 20 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist”

alias ps=“ps auxf”
alias psgrep=“ps aux | grep -v grep | grep -i -e VSZ -e”

#print username uid(1000)
alias uid1000=“awk -v val=1000 -F “:” ‘$3==val{print $1}’ /etc/passwd”

#grub update
alias grubupd=“sudo grub-mkconfig -o /boot/grub/grub.cfg”

#improve png
alias fixpng=“find . -type f -name “*.png” -exec convert {} -strip {} ;”

#mounting the folder Public for exchange between host and guest on virtualbox
alias vbm=“sudo mount -t vboxsf -o rw,uid=1000,gid=1000 Public /home/$USER/Public”

Reaload bashrc

alias rl=‘cls && . ~/.bashrc’

cli infos

alias nf=‘cls && neofetch --ascii_distro arch’
alias al=‘cls && alsi -l’
alias alsi=‘cls && alsi’

Reinitialise Resources

alias xr=‘xrdb -merge ~/.Xresources’
alias xl=‘xrdb -load ~/.Xresources && rl’

Local / Public IP

alias mypip=“curl; echo”
alias mylip=“ifconfig | sed -En ‘s/;s/.inet (addr:)?(([0-9].){3}[0-9])./\2/p’”

The ‘ls’ family

alias ll=“ls -l --group-directories-first”
alias ls=“ls -h --color” # add colors for filetype recognition
alias la=“ls -a --color” # show hidden files
alias lx=“ls -xb” # sort by extension
alias lk=“ls -lSr” # sort by size, biggest last
alias lc=“ls -ltcr” # sort by and show change time, most recent last
alias lu=“ls -ltur” # sort by and show access time, most recent last
alias lt=“ls -ltr” # sort by date, most recent last
alias lm=“ls -al |more” # pipe through ‘more’
alias lr=“ls -lR” # recursive ls
alias lsr=“tree -Csu” # nice alternative to ‘recursive ls’

Call Sublime Text

alias sub="/opt/sublime_text/sublime_text "
alias subrc="/opt/sublime_text/sublime_text ~/.bashrc"
alias subal="/opt/sublime_text/sublime_text ~/.bash/.alias"
alias subbp="/opt/sublime_text/sublime_text ~/.bash_profile"
alias subxr="/opt/sublime_text/sublime_text ~/.Xresources"

Shortcuts to edit startup files

alias vim="vim "
alias vi="vim "
alias vali=“vim ~/.bash/.alias”
alias vbrc=“vim ~/.bashrc”
alias vbpf=“vim ~/.bash_profile”

Misc utilities

alias du=“du -kh”
alias df=“df -kTh”
alias chx=“chmod +x”

launch ncmpcpp

alias ncmp=“ncmpcpp 2> /dev/null”

View the entire VIM User Guide

Change ‘vim80’ for currently installed version

if [ -x /bin/cat -a -x /usr/bin/vim ]; then
alias vug=’/bin/cat /usr/share/vim/vim80/doc/usr_*.txt | /usr/bin/vim -’

Efficient and fairly portable way to display the current iface.

[ -x /sbin/ip ] && alias iface=‘X=(/sbin/ip route) && echo ${X[4]}’

Fix all CWD file and directory permissions to match the safer 0077 umask.

if [ -x /bin/chmod ]; then
alias fixperms=’
/usr/bin/find -xdev ( -type f -exec /bin/chmod 600 “{}” + -o
-type d -exec /bin/chmod 700 “{}” + )
-printf “FIXING: %p\n” 2> /dev/null


Display a columnized list of bash builtins.

if [ -x /usr/bin/column ]; then
alias builtins=’
while read -r; do
echo “${REPLY/* }”
done <<< “$(enable -a)” | /usr/bin/column


A more descriptive, yet concise lsblk; you’ll miss it when it’s gone.

if [ -x /bin/lsblk ]; then
alias lsblkid=’
/bin/lsblk -o name,label,fstype,size,uuid,mountpoint --noheadings


Ease-of-use youtube-dl aliases; these save typing!

for DEP in /usr/{local/bin,bin}/youtube-dl; {
[ -x “$DEP” ] && {
alias ytdlv="$DEP -c --yes-playlist --sleep-interval 5
–format best --no-call-home --console-title

	alias ytdla="$DEP -cx --audio-format mp3 --sleep-interval 5\
		--max-sleep-interval 30 --no-call-home --console-title\
		--quiet --ignore-errors"

	alias ytpla="$DEP -cix --audio-format mp3 --sleep-interval 5\
		--yes-playlist --no-call-home --console-title\

	alias ytplv="$DEP -ci --yes-playlist --sleep-interval 5\
		--format best --no-call-home --console-title\

	# Just use the first result.

unset DEP


syu is the recommended way to update packages, syyu or even syy are usually not recommended, you can use it if you know why or what you’re doing.
You can even switch the “u” alias to syu in the end.

Keep in mind i update my system once a month or more, that’s why i usuallly run “u” and then update everything. But after this post i just switched “syy” to syu in the end of “u” alias here as well.

I thought yy means you force a sync even though the mirrors claim they’re already synced, right? So unless you suspect the mirrors are not correct somehow it really should just re-sync to be sure? It’s not like Syyuu that also do forced downgrades, which is another story.


I never thought you can get so much out of your bashrc. Thank you very much so far for your script-fu, masters of the terminal. :smile:
I will totally steal some lines from them…


~/.bashrc can do much more than the aliases. Note that I have nothing against aliases.

There you may have also functions, which can be set up somewhat like aliases, but are much more versatile.

Here is one of my favorite examples, the ‘e’:

# 'e' opens any file with the correct program, e.g. e test.doc opens
# a file with libreoffice for editing.
# Usage: e file-name(s)
# Assumes either exo or xdg-utils is installed.
e() { exo-open "$@" & }   # with exo
e() { xdg-open "$@" & }   # with xdg-utils

You may want to get rid of warning messages that some programs give with ‘e’:

e() { exo-open "$@" >& /dev/null & }   # now 'e' will not give any error messages

So with e you don’t have to remember which program can open a file. It works with many file types, like .doc, .odt, .pdf, .txt, etc. If some file doesn’t open with the right program, you can configure the program with your file manager.


A couple of useful commands for dealing with aliases and functions:

  • type – shows info about a commands, aliases or functions. Example:
type ls  # shows how ls is currently defined
  • typeset – can show contents of functions. Examples:
typeset -F         # shows all currently defined function names
typeset -f | less  # same as above but shows also the contents of the functions

#Alias to edit fstab
alias fstabed=“sudo nano /etc/fstab”
#Alias to edit grub
alias grubed=“sudo nano /etc/default/grub”
#Alias to update grub
alias grubup=“sudo grub-mkconfig -o /boot/grub/grub.cfg”
#Alias to update mirrorlist sync the database and update system
alias mirrors=“sudo reflector --verbose -l 50 -f 20 --save /etc/pacman.d/mirrorlist; sudo pacman -Syyu --noconfirm”
#Alias to update the system
alias update=“sudo pacman -Syu --noconfirm && yay -Syu --noconfirm”
#Alias to clean pacman cache
alias clean=“sudo pacman -Scc”
#Alias to clean all but the latest three versions of packages in cache
alias cut=“sudo paccache -rk3”
#Alias to remove uninstalled packages from the cache
alias purge=“sudo paccache -ruk0”
#Alias to remove orphaned packages
alias orphan=“sudo pacman -Rsn $(pacman -Qqdt)”
#Alias to free up RAM
alias boost=“sudo sync; echo 3 > /proc/sys/vm/drop_caches”
#Alias to trim journal size
alias vacuum=“sudo journalctl --vacuum-size=25M”
#Alias to update the hosts file
alias hostsup=“sudo ./ -ABCDF”


The pkk() function is a workaround of a “feature” of pkexec. Pkexec changes the working directory to /root before executing a command. So pkk “remembers” the working directory, and essentially works around the “wrong directory” problem.


Welcome to the forum @Jimmy_Novak :slight_smile: and thanks for the share. :+1:

And thank you @manuel for the explanation. So I was on the right path but didn’t know why this function is “necessary”. :v:


Sorry @DevNul i didn’t see your question before… It’s how manuel explained. I like xed editor and to use pkexec in my home folder i use that function i wrote. (i open the terminal in the same folder the file is)

1 Like

You use pacaur? I thought the development on it stopped a while back now actually. I used it for years myself and it was my favorite aur helper by far. But as far as I know it’s been unmaintained for a couple of years now. I switched to yay when pacaur ended - so what have happended? Someone else took over the project or you just still use it?

I believe that the original developer had stopped work on pacaur sometime ago and there was a flurry of new AUR helpers some of which I tried out. There was a lot of noise around saying pacaur was dead, however this was fud. There were sparodic updates to pacaur and the program worked throughout this period.
It seems that a new developer has stepped forward and taken up the maintenance of pacaur. I find the program very lightweight and easy to use compared to many of the other offerings.
As you can see the program is bang upto date,

First Submitted: 2019-02-14 16:38
Last Updated: 2019-04-01 23:16

I like the KISS attitude of the program, simple, slick, lightweight and does its job well.



Ha cool. I felt sorry for spyhawk/rmarquise. Trusted users and admins and mods all ganged up on him. I was sad when he said that he would leave the project to die. But originally pacaur needed cower so there must have been some changes in the code as cower doesn’t exist anymore. Anyways - I’ll check it out and if it’s anything like pacaur originally was I’ll leave yay. Thank you