Software >> OS >> Unix >> Linux >> Package Managers >> apt >> How to use apt to manage software packages


## To list installed packages

sudo apt list --installed


## To install with confirmation prompt

sudo apt install packagename


## To install without confirmation prompt

sudo apt install -y packagename


## To uninstall with confirmation prompt

sudo apt remove packagename


## To uninstall without confirmation prompt

sudo apt remove -y packagename


## Where are your apt repository sources configuration stored
## see repositories listed in /etc/apt/sources.list
## and those in *.list in /etc/apt/sources.list.d/

grep -v ^# /etc/apt/sources.list | grep -v ^$

(command output - for my machine)
deb http://sg.archive.ubuntu.com/ubuntu/ focal main restricted
deb http://sg.archive.ubuntu.com/ubuntu/ focal-updates main restricted
deb http://sg.archive.ubuntu.com/ubuntu/ focal universe
deb http://sg.archive.ubuntu.com/ubuntu/ focal-updates universe
deb http://sg.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://sg.archive.ubuntu.com/ubuntu/ focal-updates multiverse
deb http://sg.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
deb https://download.sublimetext.com/ apt/stable/

ls -l /etc/apt/sources.list.d

total 8
-rw-r--r-- 1 root root  94 Sep 10 10:48 mongodb-org-5.0.list
-rw-r--r-- 1 root root 495 Sep  8 22:59 mysql.list


## show information about a specific package


sudo apt show package_name


## for example,


sudo apt show mysql-workbench-community


(command output)
Package: mysql-workbench-community
Version: 8.0.26-1ubuntu20.04
Priority: extra
Section: utils
Maintainer: MySQL Release Engineering <mysql-build@oss.oracle.com>
Installed-Size: 154 MB
Depends: libatk1.0-0 (>= 1.12.4), libatkmm-1.6-1v5 (>= 2.24.0), libc6 (>= 2.29), libcairo2 (>= 1.15.12), libgcc-s1 (>= 4.2), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.45.4), libglibmm-2.4-1v5 (>= 2.54.0), libglx0, libgssapi-krb5-2 (>= 1.17), libgtk-3-0 (>= 3.21.5), libgtk2.0-0 (>= 2.8.0), libgtkmm-3.0-1v5 (>= 3.24.0), libmysqlclient21 (>= 8.0.11), libopengl0, libpango-1.0-0 (>= 1.18.0), libpangocairo-1.0-0 (>= 1.14.0), libpcre3, libpcrecpp0v5 (>= 7.7), libpng16-16 (>= 1.6.2-1), libproj15 (>= 6.3.0), libpython3.8 (>= 3.8.2), libsecret-1-0 (>= 0.7), libsigc++-2.0-0v5 (>= 2.8.0), libsqlite3-0 (>= 3.6.0), libssh-4 (>= 0.8.0), libssl1.1 (>= 1.1.1), libstdc++6 (>= 9), libtinfo6 (>= 6), libuuid1 (>= 2.16), libx11-6, libxml2 (>= 2.7.4), libzip5 (>= 0.10), libzstd1 (>= 1.3.2), zlib1g (>= 1:1.2.2)
Suggests: gnome-keyring, libproj-dev
Replaces: mysql-workbench, mysql-workbench-data, mysql-workbench-gpl, mysql-workbench-oss
Homepage: http://dev.mysql.com/workbench/
Download-Size: 28.2 MB
APT-Manual-Installed: yes
APT-Sources: http://repo.mysql.com/apt/ubuntu focal/mysql-tools amd64 Packages
Description: MySQL Workbench
 MySQL Workbench is development, administration and data modeling tool
 for MySQL. Besides editing and running SQL queries and scripts, it supports
 the design of MySQL databases through a EER diagram, which is then used to
 generate SQL scripts. Workbench also supports migration from many RDBMS