Skip to content

Instantly share code, notes, and snippets.

@juliyvchirkov
Last active May 30, 2022 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliyvchirkov/7ee6591b9744c36fa9ab73a1ca2ef544 to your computer and use it in GitHub Desktop.
Save juliyvchirkov/7ee6591b9744c36fa9ab73a1ca2ef544 to your computer and use it in GitHub Desktop.
bash: apt bootstrap to implement options shortcuts
#!/usr/bin/env bash
#
# Provides shortcuts for apt options
#
# @see https://gist.github.com/juliyvchirkov/7ee6591b9744c36fa9ab73a1ca2ef544#file-quickinstall-rst
case ${1} in
i)
arg1st="install" ;;
ri)
arg1st="install --reinstall" ;;
u|up|upd)
arg1st="update" ;;
l)
arg1st="list" ;;
li)
arg1st="list --installed" ;;
lu)
arg1st="list --upgradable" ;;
upg)
arg1st="upgrade" ;;
fu)
arg1st="full-upgrade" ;;
r|e|d|rm)
arg1st="remove" ;;
rp)
arg1st="remove --purge" ;;
ra|ar)
arg1st="autoremove" ;;
s)
arg1st="show" ;;
g|f)
arg1st="search" ;;
p)
arg1st="purge" ;;
es)
arg1st="edit-sources" ;;
sd)
arg1st="satisfy" ;;
*)
arg1st=${1} ;;
esac
shift
[ -z ${SUDO_USER} ] && sudo=/usr/bin/sudo || sudo=
exec ${sudo} /usr/bin/apt ${arg1st} ${@}

apt bootstrap

Provides shortcuts for apt options

i

install

ri

reinstall

u

update

up

same as above

upd

same as above

l

list

li

list --installed

lu

list --upgradable

upg

upgrade

fu

full-upgrade

r

remove

e

same as above

d

same as above

rm

same as above

rp

remove --purge

ar

autoremove

ra

same as above

s

show

g

search

f

same as above

es

edit-sources

sd

satisfy

p

purge

Feel free to add your own and modify the existing shortcuts

Quick install

  1. Paste this commands sequence to your console
  2. Execute
  3. Enjoy!
pushd /usr/bin >/dev/null &&
sudo wget -q https://gist.githubusercontent.com/juliyvchirkov/7ee6591b9744c36fa9ab73a1ca2ef544/raw/apt.sh &&
sudo chmod 755 apt.sh &&
alias apt='/usr/bin/apt.sh' &&
printf "\nalias apt='/usr/bin/apt.sh'\n" >>~/.bashrc &&
popd >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment