DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for APT sucks, use Nala instead!
MD Taseen Khan
MD Taseen Khan

Posted on

APT sucks, use Nala instead!

canonical_url

APT sucks, use Nala instead!

APT Documentation

What is APT ??

apt is a command-line utility for installing, updating, removing, and otherwise managing deb packages on Ubuntu, Debian, and related Linux distributions. It combines the most frequently used commands from the apt-get and apt-cache tools with different default values of some options.

apt is designed for interactive use. Prefer using apt-get and apt-cache in your shell scripts as they are backward compatible between the different versions and have more options and features.

Most of the apt commands must be run as a user with sudo privileges.

This guide serves as a quick reference for the apt commands.

Updating package index (apt update)

The APT package index is basically a database that holds records of available packages from the repositories enabled in your system.

To update the package index run the command below. This will pull the latest changes from the APT repositories:

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Always update the package index before upgrading or installing new packages.

Upgrading packages (apt upgrade)

Regularly updating your Linux system is one of the most important aspects of overall system security.

To upgrade the installed packages to their latest versions run:

sudo apt upgrade
Enter fullscreen mode Exit fullscreen mode

The command doesn’t upgrade packages that require removal of installed packages.

If you want to upgrade a single package, pass the package name:

sudo apt upgrade package\_name
Enter fullscreen mode Exit fullscreen mode

It is always a good idea to configure automatic security updates .

Full Upgrading (apt full-upgrade)

The difference between upgrade and full-upgrade is that the later will remove the installed packages if that is needed to upgrade the whole system.

sudo apt full-upgrade
Enter fullscreen mode Exit fullscreen mode

Be extra careful when using this command.

Installing packages (apt install)

Installing packages is as simple as running the following command:

sudo apt install package\_name
Enter fullscreen mode Exit fullscreen mode

If you want to install multiple packages with one command, specify them as a space-separated list:

sudo apt install package1 package2
Enter fullscreen mode Exit fullscreen mode

To install local deb files provide the full path to file. Otherwise, the command will try to retrieve and install the package from the APT repositories.

sudo apt install /full/path/file.deb
Enter fullscreen mode Exit fullscreen mode

Removing Packages (apt remove)

To remove an installed package type the following:

sudo apt remove package\_name
Enter fullscreen mode Exit fullscreen mode

You can also specify multiple packages, separated by spaces:

sudo apt remove package1 package2
Enter fullscreen mode Exit fullscreen mode

The remove command will uninstall the given packages, but it may leave some configuration files behind. If you want to remove the package including all configuration files, use purge instead of remove :

sudo apt purge package\_name
Enter fullscreen mode Exit fullscreen mode

Remove Unused Packages (apt autoremove)

Whenever a new package that depends on other packages is installed on the system, the package dependencies will be installed too. When the package is removed, the dependencies will stay on the system. This leftover packages are no longer used by anything else and can be removed.

To remove the unneeded dependencies use the following command:

sudo apt autoremove
Enter fullscreen mode Exit fullscreen mode

Listing Packages (apt list)

The list command allows you to list the available, installed and, upgradeable packages.

To list all available packages use the following command:

sudo apt list
Enter fullscreen mode Exit fullscreen mode

The command will print a list of all packages, including information about the versions and architecture of the package. To find out whether a specific package is installed, you can filter the output with the grep command.

sudo apt list | grep package\_name
Enter fullscreen mode Exit fullscreen mode

To list only the installed packages type:

sudo apt list --installed
Enter fullscreen mode Exit fullscreen mode

Getting a list of the upgradeable packages may be useful before actually upgrading the packages:

 sudo apt list --upgradeable
Enter fullscreen mode Exit fullscreen mode

Searching Packages (apt search)

This command allows you to search for a given package in the list of the available packages:

sudo apt search package\_name
Enter fullscreen mode Exit fullscreen mode

If found, the command will return the packages which name matches the search term.

Package Information (apt show)

The information about the package dependencies, installation size, the package source, and so on might be useful before removing or installing a new package.

To retrieve information about a given package, use the show command:

 sudo apt show package\_name
Enter fullscreen mode Exit fullscreen mode
apt 2.4.2 (amd64)
Usage: apt [options] command

apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options more suitable for
interactive use by default.

Enter fullscreen mode Exit fullscreen mode

Most used commands:

  list - list packages based on package names
  search - search in package descriptions
  show - show package details
  install - install packages
  reinstall - reinstall packages
  remove - remove packages
  autoremove - Remove automatically all unused packages
  update - update list of available packages
  upgrade - upgrade the system by installing/upgrading packages
  full-upgrade - upgrade the system by removing/installing/upgrading packages
  edit-sources - edit the source information file
  satisfy - satisfy dependency strings

See apt(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
                                        This APT has Super Cow Powers.


Enter fullscreen mode Exit fullscreen mode

Nala Documentation

What is Nala ??

Nala is a front-end for libapt-pkg. Specifically we interface using the python-apt api.

Especially for newer users it can be hard to understand what apt is trying to do when installing or upgrading.

We aim to solve this by not showing some redundant messages, formatting the packages better, and using color to

show specifically what will happen with a package during install , removal , or an upgrade.

usage:

nala [--options] <command>
Enter fullscreen mode Exit fullscreen mode

commands:

    install            install packages

    remove             remove packages

    purge              purge packages

    update             update package list and upgrade the system

    upgrade            alias for update

    fetch              fetches fast mirrors to speed up downloads

    show               show package details

    history            show transaction history

    clean              clears out the local repository of retrieved package files

Enter fullscreen mode Exit fullscreen mode

image 1

optional arguments:

  -h, --help           show this help message and exit

  -y, --assume-yes     assume 'yes' to all prompts and run non-interactively

  -d, --download-only  package files are only retrieved, not unpacked or installed

  -v, --verbose        logs extra information for debugging

  --no-update          skips updating the package list

  --no-autoremove      stops nala from autoremoving packages

  --remove-essential   allows the removal of essential packages

  --raw-dpkg           skips all formatting and you get raw dpkg output

  --update             updates the package list

  --debug              logs extra information for debugging

  --version            show program's version number and exit

  --license            reads the licenses of software compiled in and then reads the GPLv3
Enter fullscreen mode Exit fullscreen mode

image 2

Steps to install:

git clone https://gitlab.com/volian/nala
Enter fullscreen mode Exit fullscreen mode
cd nala
Enter fullscreen mode Exit fullscreen mode
 python3 ./setup.py build

Enter fullscreen mode Exit fullscreen mode
 sudo python3 ./setup.py install
Enter fullscreen mode Exit fullscreen mode

It also has a apt repo:

echo "deb [arch=amd64,arm64,armhf] http://deb.volian.org/volian/ scar main" | sudo tee /etc/apt/sources.list.d/volian-archive-scar-unstable.list
Enter fullscreen mode Exit fullscreen mode
wget -qO - https://deb.volian.org/volian/scar.key | sudo tee /etc/apt/trusted.gpg.d/volian-archive-scar-unstable.gpg > /dev/null
Enter fullscreen mode Exit fullscreen mode
sudo apt update && sudo apt install nala
Enter fullscreen mode Exit fullscreen mode

Thanks

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.