If you use debian you probably know
apt, I believe it's actually a frontend for other set of tools that debian has to manipulate the packages in your system.
apt is great, it's just that sometimes I forget to write
sudo before a command and sometimes I forget that I want to use
apt purge instead of
apt remove. It's this kinds of things I don't want to think about. And usually this is the part where make some cool alias and live happily ever after, but I'm trying something different now. This time I just want descriptive commands. What I did was create
pkg script with the following commands.
Sync with repositories before upgrading packages.
sudo apt update && sudo apt upgrade
Update and refresh the local package database.
sudo apt update
Search for packages in the repositories.
apt search [args]
Display information about a package in the repositories.
apt show [args]
Install packages from the repositories.
sudo apt install [args]
Remove packages, including its settings and dependencies.
sudo apt purge [args] && sudo apt autoremove
Remove packages, keeping its settings and dependencies.
sudo apt remove [args]
Remove all cached versions of uninstalled packages.
sudo apt-get autoclean
Completely remove all packages from the cache.
sudo apt-get clean
This way when I say
pkg remove [package-name] I'm saying "destroy the damn thing and leave no trace". See how nice that is? I don't even have to think about
If you're curious how you can do something like this, well you can create a file and start writing your commands.
#! /usr/bin/env sh # Save the first argument to `cmd` # and remove it from the argument list cmd=$1; shift if [ "$cmd" = 'upgrade' ];then sudo apt update && sudo apt upgrade exit 0 fi if [ "$cmd" = 'install' ];then sudo apt install $@ exit 0 fi # ... more and more commands
You save it then make it executable with
chmod +x [name-of-script]. Next step is to put the script somewhere in a folder of your PATH (don't know what they are? Use
echo "$PATH") preferably one that is located in your home directory. That's it, next time you open up a terminal you'll have this handy command.
My version of this wrapper is located here. And there is also a version for arch (pacman).
Top comments (0)