Posted: . At: 9:13 AM. This was 12 months ago. Post ID: 17957
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to uninstall software on Ubuntu and other useful tips.


Most people won’t get beyond the basics, so in this tutorial we’re going to show you how to get the most from this powerful package management tool, turning you from a beginner to an advanced user in a flash. We’re not going to assume that you’ve actually used apt-get before, simply because a lot of people only use Synaptic, the standard GUI utility of choice for the majority of Debian and Ubuntu users. So, the first thing to do is get yourself to the command line and get ready to rumble. Because apt-get makes system-wide changes, you either need to work as root, or with superuser powers before you’re actually able to do anything. In this tutorial we’ll assume that you’ve already moved to the root prompt; if you’re using Ubuntu then you should prefix every command with sudo to elevate your privileges. The first thing you would need to run is this.

╭──(john㉿DESKTOP-PF01IEE)-[~]
╰───────────────────────────╾┋ sudo apt-get update
[sudo] password for john: 
Get:1 http://kali.download/kali kali-rolling InRelease [41.2 kB]
Get:2 http://kali.download/kali kali-rolling/main amd64 Packages [19.3 MB]
Get:3 http://kali.download/kali kali-rolling/non-free amd64 Packages [217 kB]
Get:4 http://kali.download/kali kali-rolling/contrib amd64 Packages [116 kB]
Fetched 19.6 MB in 5s (3,977 kB/s)                       
Reading package lists... Done

This tells apt-get to update its information about available packages, using details gleaned from the sources.list file. It’s important that you do this before you go any further, so as to ensure that you have the latest information about the most up-to-date packages. Once apt-get has finished processing, you can issue the command:

╭──(john㉿DESKTOP-PF01IEE)-[~]
╰───────────────────────────╾┋ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  dh-elpa-helper g++-11 gstreamer1.0-gl isa-support libatk1.0-data libavcodec58 libavdevice58 libavfilter7 libavformat58 libavutil56 libdav1d5 libflac8 libgraphene-1.0-0 libgstreamer-gl1.0-0 libicu67 libigdgmm11 libilmbase25 libimobiledevice6 libjs-highlight.js libjs-psl
  libldap-2.4-2 liblerc3 libllvm12 libmpdec3 libmujs1 libnetpbm10 libnode72 libobjc-11-dev libopenexr25 libpari-gmp-tls7 libperl5.32 libperl5.34 libplacebo120 libplacebo192 libplist3 libpoppler118 libpoppler123 libpostproc55 libpython3.10 libpython3.10-dev
  libpython3.10-minimal libpython3.10-stdlib libpython3.9 libpython3.9-dev libpython3.9-minimal libpython3.9-stdlib libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5xml5 libsrt1.4-gnutls libstdc++-11-dev libsvtav1enc0 libswresample3 libswscale5 libusbmuxd6 libwebp6
  libwireshark15 libwiretap12 libwmf-0.2-7 libwmf0.2-7 libwsutil13 libx264-160 node-abab node-ansistyles node-array-union node-array-uniq node-asap node-asynckit node-big.js node-combined-stream node-cssom node-cssstyle node-delayed-stream node-domelementtype node-domhandler
  node-emojis-list node-entities node-execa node-exit-hook node-form-data node-formidable node-jsdom node-loader-utils node-mimic-fn node-parse5 node-psl node-stealthy-require node-strip-eof node-tough-cookie node-uniq node-universalify node-webidl-conversions
  node-whatwg-fetch perl-modules-5.32 perl-modules-5.34 python3-charset-normalizer python3-idna python3-ldb python3-psutil python3-pyqt5.sip python3-requests python3-setproctitle python3-talloc python3-urllib3 python3.10 python3.10-dev python3.10-minimal python3.9
  python3.9-dev python3.9-minimal ruby2.7 ruby3.0 sound-theme-freedesktop sse3-support telnet usbmuxd
Use 'sudo apt autoremove' to remove them.
The following packages have been kept back:
  ghostscript libgs9-common libnode-dev nodejs
The following packages will be upgraded:
  adduser apache2 apache2-bin apache2-data apache2-utils avahi-daemon avahi-utils bash burpsuite chromium chromium-common chromium-sandbox console-setup console-setup-linux curl e2fsprogs fakeroot fuse3 keyboard-configuration libapache2-mod-php8.2 libargon2-1 libavahi-client3
  libavahi-common-data libavahi-common3 libavahi-core7 libc-bin libc-dev-bin libc-devtools libc-l10n libc6 libc6-dev libc6-dev-i386 libc6-dev-x32 libc6-i386 libc6-x32 libcom-err2 libcryptsetup12 libcups2 libcurl3-gnutls libcurl3-nss libcurl4 libdebconfclient0 libext2fs2
  libfakeroot libfuse3-3 libglib2.0-0 libglib2.0-bin libglib2.0-data libgnutls30 libjs-sphinxdoc libldb2 libmbedcrypto7 libpaper-utils libpaper1 libpcsclite1 libprotobuf-lite32 libpython3-dev libpython3-stdlib libruby3.1 libsmbclient libss2 libwbclient0 libx264-164 libxml2
  libxml2-dev libxt6 libzstd1 linux-libc-dev locales-all logsave mpv node-interpret pci.ids php8.2 php8.2-cli php8.2-common php8.2-curl php8.2-opcache php8.2-readline python3 python3-dev python3-ldb python3-minimal python3-wheel ruby3.1 samba-libs sslscan sysvinit-utils tar
  tzdata vim vim-common vim-runtime vim-tiny wordlists xxd
96 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
Need to get 426 MB of archives.
After this operation, 5,061 kB of additional disk space will be used.
Do you want to continue? [Y/n]

This will download any newer versions of currently installed applications, along with their dependencies. It then does the necessary. Beyond that, the only other basic uses of apt-get that you need to know at this stage are:

╭──(john㉿DESKTOP-PF01IEE)-[~]
╰───────────────────────────╾┋ sudo apt-get install vim-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
vim-common is already the newest version (2:9.0.1378-1).

This installs the vim-common command. Below is how to uninstall a program.

╭──(john㉿DESKTOP-PF01IEE)-[~]
╰───────────────────────────╾┋ sudo apt-get remove burpsuite
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  burpsuite
0 upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
After this operation, 236 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 150746 files and directories currently installed.)
Removing burpsuite (2023.3.5-0kali1) ...

This will uninstall the Firefox browser.

First off, although apt-get is a pretty efficient package manager, it can generate a fair amount of cruft over time, which isn’t necessarily handled automatically by Apt in the day-to-day running of your system. This cruft is mostly made up of packages that have already been processed and installed but lie dormant in the filesystem. Depending on how old your system is, you may never find this a real problem, particularly if you move between distros regularly. But if you’re relying on a Debian install or one of the Ubuntu LTS releases, then you’ll feel the benefit of cleaning up every once in a while. Just issue the command:

╭──(john㉿DESKTOP-PF01IEE)-[~]
╰───────────────────────────╾┋ sudo apt-get clean

Apt will then clean up all the package files that are no longer needed, giving you back a fair chunk of disk space, especially f you’ve been running your system for a while or have performed some major upgrades. The only potential downside with this is that if you need to re-install a package, apt-get will need to download the package in question again. To avoid this, and if you’re not too worried about disk space, then you may want to try out:

╭──(john㉿DESKTOP-PF01IEE)-[~]
╰───────────────────────────╾┋ sudo apt-get autoclean

This gets rid of any packages that are no longer required – for instance, if you’ve performed a couple of upgrades to a specific package on your system, then autoclean will remove all the extra packages, other than the one that’s currently installed. If you find yourself doing a lot of re-installing, this will save you time, even if you have a fast internet connection. Another option, if you’re particularly fastidious with your package management, is to use the purge switch rather than simply remove; doing so gets rid of the package in question, but also clears away any configuration files that were in use. The final string in your apt-get maintenance armoury is:

╭──(john㉿DESKTOP-PF01IEE)-[~]
╰───────────────────────────╾┋ sudo apt-get autoremove

The autoremove command clears any packages that were installed to satisfy dependencies, but are no longer required. Having looked at how to clean up after Apt, what if you prefer to compile all your packages from source, à la Gentoo? Well, it’s certainly possible with apt-get, and in fact, we’d argue that it’s probably the easiest way to dip your toes into the compilation hot tub, particularly because it can take a lot of pain out of compiling. We’ll start off by simply retrieving the source code, for which you’d fire off the command:

╭──(john㉿DESKTOP-PF01IEE)-[~]
╰───────────────────────────╾┋ sudo apt-get source emacs

This will retrieve the source files, including a .dsc one that is used by dpkg-source to tell apt-get how to unpack the source code. This is usually in a directory under your current working folder, named after the source package. It’s then ready for you to compile in the usual way.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.