TechAwesome!

Basics of software management through the console in Debian distros

Mon, 04/03/2017 - 13:22

There are many graphical tools designed for software installation in Linux distributions. Now, in many distributions, it's not complicated, as was the case six or seven years ago. Many people are terrified at the thought of working with the console. In Debian-based Linux distributions, text-mode package management is very easy and convenient. In this article, I will show you some tips regarding software management through the console in Debian-based Linux distributions. Why Debian? Debian is the basis of the largest number of Linux distributions, has a large base of software and is very easy to use.

 

Apt is very powerful!

Apt is a command-line tool for package management in Debian and Debian-based distributions. Here, I would like to show you some useful, basic operations that will help you work with it.

 

Searching
Apt has very intuitive tools designed for searching for packages in repositories. You don't need to know regular expressions or have any arcane knowledge.
For example, when you are looking for a web browser, type:

apt search web browser

Apt will look for the phrase in package names and descriptions.
Sometimes, Apt returns many results and you can have problems with browsing through them. Here, less can be a very useful tool.
For example:

apt search editor | less

 

Sometimes, when you find an app or a lib, you want to know more about it. For instance, if you want to read something about the Kate editor, you can type:

apt show kate

This command returns the details of the package, such as application description, dependencies, package contributor, package size etc.

 

When we know everything and want to install apps

For this operation, we need root privileges. In order to obtain them, we can log in as root through the su command or by means of typing all commands though sudo.

Application installation is very easy.

As root (after logging in):

apt install firefox

As a user through sudo:

sudo apt install gimp

 

After typing these commands, Apt will automatically install the application with all dependencies.

 

When something goes wrong

For example, when the installation is unexpectedly stopped by battery discharge, we can type:

apt -f install

Here, Apt will decide whether to reinstall the software from the beginning or whether to uninstall it.

In case of severe damage, the following command can prove helpful:

dpkg-reconfigure -a

It will reconfigure all packages in your system.

 

Installing software from deb files could be a little more difficult. Why? We have to install all package dependencies manually.

If you want to install an app from a deb, type:

dpkg -i /path-to-file/package.deb

 

How to uninstall aps? For instance, Kate editor:

apt remove kate

 

System upgrade

System upgrade is very, very easy. As previously, you need root privileges.

Before the upgrade, it's a good idea to update the local base of packages and the repository with the use of the following command:

apt update

and, then:

apt upgrade

We can do it also with a single command:

apt update && apt upgrade

Okay! Sometimes, Apt returns a message than some packages were blocked.

Why? Because one has to install additional packages and remove the old ones.

The solution for this is dist-upgrade:

apt dist-upgrade

 

If something went wrong

As previously, an unexpected stop. Running upgrade helps sometimes. One can also try to use apt -f install or dpkg-reconfigure -a.

 

That's all. I hope it helps you in everyday work with your Linux-based distro. Remember, there are many graphical and easy to use tools designed for software management, such as Synaptic or Apper.