How to install, update & remove packages in Ubuntu?

navya , Credit to  volkotech-solutions Nov 18
Package management in Ubuntu via command line Banner Image

This blog covers the basics of package management in Ubuntu, including how to install, update, and remove packages using both the terminal and the user interface.

Ubuntu is built on the Linux platform, it is completely free and open-source software. The official editions of Ubuntu are Desktop, Server, and core for IoT devices and it can run both on the computer and virtual machines.

Pre-requisites:

  • Laptop/pc with Ubuntu os

Ubuntu, one of the Linux Operating systems that are freely available for both professional and community purposes which is built on Debian’s architecture. Most of the developers prefer Ubuntu, as it is user-friendly, secure, and does not require any type of antivirus pre-installed for Ubuntu OS installation.

Check the below link to install ubuntu on your Laptop/pc: https://mycode.blog/naveen-golla/how-install-ubuntu-your-computer

Now, after installation, we need to use the OS. In the below section there is a clear explanation about how to interact with ubuntu through the command line as well as UI.

At the very beginning, we will look into how to install software packages, upgrading and removing unwanted software.

Downloading required packages:

The command that is used to download the package is, sudo apt install <package name>
Here we are using sudo in front of apt install because as we know that Ubuntu is very safe and secure, it needs the authentication of superuser, who is the owner of the computer for any type of action.

Installing packages using Ubuntu terminal

Now in this example, we have installed a package called gedit, by using the terminal command, right after the command sudo apt install gedit, the terminal will ask the password of the superuser that is the owner of the current computer. Now type the password and press enter, that’s all, your required package will be installed.

Upgrading required packages:

In Ubuntu, Upgrading packages is very simple and the command used to upgrade your package is sudo apt upgrade <package name>.

Now you can see in the below picture, right after the command the package will start upgrading and will ask if it may use your disk space still, continue. so type Y for confirmation and the rest of the story will be taken care of by the system.

Upgrading packages using Ubuntu command line

 

Upgrade packages using Ubuntu terminal

Updating required packages:

In Ubuntu, the only command that you need to use to update your package is 
sudo apt update <package name>.

Now you can see the below screenshot, that right after the command the package will start getting updated to the latest version.

Updating packages using Ubuntu terminal

 

Removing required packages:

In Ubuntu, we can remove the unwanted packages with the following command
sudo apt remove <package name>.

In the below screenshot, you can see the result of removing the package. Here you can get a message that the following packages have been removed.
Removing packages using Ubuntu terminal

Auto-remove

Along with these four commands we also have sudo apt autoremove, this will remove the unwanted dependencies of all the packages, but it is not recommended to do so, why because it will remove all the unused packages from your system that may lead to losing the data.

Conclusion: 

With these simple commands, you can install, update and remove in Ubuntu packages. So go on and get started. 
Feel free to share your comments and suggestions, thank you.

FAQ

What is the difference between package and application?

The package is like just a collection of files that may be used for deployments by the developers and the end-user may not run these packages, Whereas the Application is used to perform some actions by the end-user.

What is the difference between command update and upgrade?

Upgrading in the sense of getting a new version of the application.
In the software, if there is any add-on feature or any bug fixes from the developer end results in Updating the software.

Why should we remove the unused packages?

As for performance matters, to every end-user or a developer, we should remove the unused files related to the packages, or else they will affect the machine memory and slow down the performance of your machine.

Comments

Authors

Read Next