PostgreSQL is a popular database software used by many websites & organizations. However, sometimes you may need to remove PostgreSQL completely from your system, in case of issues. In this article, we will learn how to completely uninstall PostgreSQL from Ubuntu.
How to Completely Uninstall PostgreSQL from Ubuntu
Here are the steps to completely uninstall PostgreSQL from Ubuntu.
1. Uninstall PostgreSQL
Open terminal and run the following command to remove PostgreSQL from Ubuntu.
$ sudo apt-get --purge remove postgresql
2. List Dependent Packages
Next, run the following command to list dependent packages.
$ dpkg -l | grep postgres
Remove the packages listed in output using the following command.
$ apt-get --purge remove package1 package2 ...
3. Verify Uninstallation
You can verify that PostgreSQL is removed by running the following command.
$ whereis postgres $ whereis postgresql
That’s it. In this short article, we have seen how to quickly remove PostgreSQL from Ubuntu.
Also read:
How to Setup NTP Server & Client in Ubuntu
How to Add User in Sudoers in Linux
How to Install Brotli for NGINX in Ubuntu
How to Uninstall Docker in CentOS
Related posts:
How to Run Same Command Multiple Times in Linux
How to Read Variable from File in Shell Script
How to View Linux Log Files
How to Run Command After Certain Time in Linux
How to Use Boolean Variables in Shell Script
How to Suspend Process in Linux
How to Install MongoDB in Ubuntu 18.04/20.04
How to Use SCP with PEM File (SSH Key)

Sreeram has more than 10 years of experience in web development, Python, Linux, SQL and database programming.