Skip to content

Instantly share code, notes, and snippets.

@Galacticai
Last active March 12, 2026 14:57
Show Gist options
  • Select an option

  • Save Galacticai/c3db80565bd866ca408776a0ae27f988 to your computer and use it in GitHub Desktop.

Select an option

Save Galacticai/c3db80565bd866ca408776a0ae27f988 to your computer and use it in GitHub Desktop.
Arch Linux terminal aliases

Requirements:

depending on which parts you copy

  • lsd
  • ranger
  • tree
  • pacman
  • yay
  • flatpak
  • git

Aliases

paste in ~/.zshrc or ~/.bashrc

alias l="lsd"
alias la="lsd -a"
alias ll="lsd -l"
alias lla="lsd -la"
alias lr="ranger ."
lt() { tree -C -L "${1:-2}" "${@:2}" | less; }

alias c="clear"

alias pac="sudo pacman"
alias i="pac -S"
alias u="pac -Sy"
alias U="pac -Syu"
alias r="pac -R"

alias yi="yay -S"
alias yu="yay -Sy"
alias yU="yay -Syu"
alias yr="yay -R"

alias fp="flatpak"
alias fpi="fp install"
alias fpu="fp update"
alias fpr="fp remove"

UPDATE() {
  echo "➡️ KDE themes/icons/... can't be updated here. This will update using pacman and flatpak"
  U
  yU
  fpu
}

alias g="git"
alias gr="g reset HEAD~"
alias gp="g push"
alias gP="gp --force-with-lease"
alias gPP="gp --force"
alias gs="g stash"
alias gsp="gs pop"
unalias gss >/dev/null
gss() { git stash push --staged -m "$*"; }
alias gsl="gs list"
alias gsa="gs apply"
gsA() {
  gsa $1
  gs drop $1
}
# amend + push
gcP() {
  git commit --amend --no-edit
  gP
}

Recommendations

better fonts

icons in ranger



Extras

export EDITOR=nano
export VISUAL=nano
export LESS="-R --use-color"
export LESSEDITOR="nano"

his() {
  local msg from to f="$HOME/.zsh_history" b=".bak" 
  local date dateFormat="%Y-%m-%d %H:%M:%S"
  case "$1" in
    bak)  from=""   to="$b"   msg="history copied   ——>"  ;;
    res)  from="$b" to=""     msg="history restored <——"  ;;
    *)    echo "usage: his {bak|res}"; return 1           ;;
  esac
  
  if [ -e "$f$from" ]; then
    if stat -c '%y' "$f$from" >/dev/null 2>&1; then
      date=$(stat -c '%y' "$f$from")
    elif stat -f '%Sm' -t $dateFormat "$f$from" >/dev/null 2>&1; then
      date=$(stat -f '%Sm' -t $dateFormat "$f$from")
    else
      date=$(date -r "$f$from" $dateFormat 2>/dev/null || echo 'unknown')
    fi
  fi

  cp -p "$f$from" "$f$to"
  echo $msg $date
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment