Ways to Install and Uninstall gdb-source Ubuntu 22.04

Updated: October 20, 2022

GDB is a source-level debugger, capable of breaking programs at any specific line, displaying variable values, and determining where errors occurred. Currently, gdb supports C, C++, D, Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2, Go, and Ada. A must-have for any serious programmer. In this guide, I will show you how to install gdb-source on Ubuntu 22.04.


  • Operating system: Ubuntu 22.04 or older Ubuntu versions
  • Privileges: Ensure that you are able to execute the sudo commands line.

Prerequisites to install gdb-source on Ubuntu 22.04

Install gdb-source Ubuntu 22.04

gdb-source is one of the popular ways on Ubuntu now so that this tutorial will show you some ways to install it. Choose the one that you think is easy and you can follow.

Install gdb-source using APT

This is one of the popular ways to install any Ubuntu packages because it is simple to understand, even if you are a Linux novice. Following these steps to install gdb-source on your Ubuntu 22.04.

Step 1: You must update the APT package repository cache before attempting to install, update, or remove any packages. Obtain new packages from Ubuntu by updating the APT database. Opening the terminal and executing this Linux command:

sudo apt -y update

Step 2: Start the package installation on Ubuntu 22.04. After updating the system, you can install gdb-source Ubuntu by pasting this command into the terminal and pressing Enter.

sudo apt-get install gdb-source

Install gdb-source using Aptitude

Users can manage their installation, upgrade, and removal of packages with Aptitude and view a list of the packages that are currently available. If you haven’t already installed it on Ubuntu, run this command to do so.

sudo apt -y install aptitude

After installing aptitude, you can now install gdb-source by following these steps:

Step 1: Update the APT database to download new packages from Ubuntu. Opening the terminal and executing this Linux command:

sudo apt-get -y update

Step 2: Install the package on Ubuntu 22.04. You can now install gdb-source Ubuntu by executing this command in the terminal.

sudo aptitude -y install gdb-source

Uninstall gdb-source on Ubuntu 22.04

Have you ever thought that uninstalling an application from Ubuntu might be challenging? You’re wrong; any program, not just a gdb-source, can be easily uninstalled by anyone.

You can uninstall gdb-source on Ubuntu by running this command if you installed it using APT or Aptitude.

sudo apt remove --auto-remove gdb-source

You can also execute this command if you want to uninstall gdb-source and remove its data and dependencies:

sudo apt autoremove --purge gdb-source


In this tutorial, I showed you ways to install gdb-source on Ubuntu 22.04 and ways to uninstall gdb-source too. Please contact me if you require any assistance. I’d be delighted to respond.