Post

How To Manage Debian Packages


You can download anything from the web browser. So, why go through the trouble of downloading it in the terminal ? Well, next time you will have the superpower to download anything, the cool way.

The command I am using is wget and the URL passed to it is the repository location of .deb file.

1
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

wget command syntax

1
wget [options] [URL]
OPTIONSDESCRIPTION
wget -O filename URLSaving the downloaded file under a different name
wget -P file path URLDownloading a File to a Specific Directory
wget –limit-rate=1m URLLimiting the download speed , 1m means 1 megabyte, 1k means 1 kilobyte, 1g means 1 gigabyte
wget -c URLResuming a download
wget -b URLDownloading in Background
tail -f wget-logBy default, the output is redirected to wget-log file in the current directory. To watch the status of the download, use the tail command

These were some of the basic options with wget. We can change the Wget User-Agent, download multiple files, download via FTP, Create a mirror of a Website, skip certificate check, download to the standard output. Here is the GNU Wget’s dirty manual.


Now we have downloaded the file, we need to install the Debian package. dpkg is the package manger for Debian.

1
dpkg [options...] action
CommandFunction
dpkg -i package_file.debInstall package
sudo apt -f installto fix the unmet dependency issues once a debian package is installed
dpkg -I /path/to/file.debList all dependencies of a Deb file
dpkg-deb -c /path/to/file.debList all the files that will be installed from a deb package
dpkg-deb –extract /path/to/file.debExtract all files from a deb package

Learn more about it here .


We can use apt to install the Debian package as well

1
apt 

Most of the apt command must be run as a user with sudo privileges. apt-get and apt-cache are backward compatible between the different versions and have more options and features.

CommandFunction
sudo apt listListing packages
sudo apt list –installedList installed packages only
sudo apt search package_nameSearching packages
sudo apt show package_namePackage Information
sudo apt list –upgradeableList all upgrade able packages
sudo apt updateUpdating package index
sudo apt upgradeupgrading the packages to their latest versions
sudo apt upgrade package_nameupgrade a single package
sudo apt full-upgradeIt will remove the installed packages if that is needed to upgrade the whole system
sudo apt install Package_name 1 Package_name 2Installing packages
sudo apt install /full/path/file.debTo install local deb file

Let’s delete the packages now

CommandFunction
sudo apt remove package_nameRemoving Package
sudo apt purge package_nameIt will remove package file including all configuration files
sudo apt autoremoveRemove Unused Packages

Learn more about apt here

This post is licensed under CC BY 4.0 by the author.