Skip to content
www.mytechnote.ru
Menu
  • Administration
    • Scripts
  • Equipment
    • Reviews
    • Instructions
  • Other
  • English
    • English
    • Русский
Menu

Ultimate Guide to Removing Software with APT in Ubuntu

Are you struggling to manage and remove software on your Ubuntu system? You’re in the right place. Learn how to efficiently uninstall packages using the APT package manager with this comprehensive guide.

1. Mastering Basic Uninstall Commands:

  • Effortless Package & Dependency Removal:

Use the below command to quickly uninstall a software package and its redundant dependencies:

sudo apt-get autoremove program_name

·  Direct Package Removal:

Want to keep the dependencies but remove the main software? Here’s how:

sudo apt-get remove program_name

·  Wipe Out Configuration Files:

Leave no trace behind by purging associated configuration files:

sudo apt-get purge program_name

2. Unlocking the Power of the APT Log:

Ever felt apt-get autoremove missed something? Dive deep into the APT log to ensure a clean slate:

cat /var/log/apt/history.log | more

Example of the output:

Start-Date: 2016-08-03  07:46:19
Commandline: apt-get install samba
Install: python-tdb:amd64 (1.3.8-2, automatic), python-samba:amd64 (2:4.3.9+dfsg
-0ubuntu0.16.04.2, automatic), python-dnspython:amd64 (1.12.0-1, automatic), sam
ba:amd64 (2:4.3.9+dfsg-0ubuntu0.16.04.2), samba-dsdb-modules:amd64 (2:4.3.9+dfsg
-0ubuntu0.16.04.2, automatic), libaio1:amd64 (0.3.110-2, automatic), tdb-tools:a
md64 (1.3.8-2, automatic), attr:amd64 (1:2.4.47-2, automatic), samba-common:amd6
4 (2:4.3.9+dfsg-0ubuntu0.16.04.2, automatic), samba-vfs-modules:amd64 (2:4.3.9+d
fsg-0ubuntu0.16.04.2, automatic), samba-common-bin:amd64 (2:4.3.9+dfsg-0ubuntu0.
16.04.2, automatic), python-ldb:amd64 (2:1.1.24-1ubuntu3, automatic)
End-Date: 2016-08-03  07:47:23

3. Real-world Scenario: The Samba Package:

After installing samba, you’ll notice related dependencies like python-tdb or python-samba. To remove them all in one swoop, execute:

sudo apt-get autoremove --purge python-tdb python-samba python-dnspython samba samba-dsdb-modules libaio1 tdb-tools attr samba-common samba-vfs-modules samba-common-bin python-ldb

4. Automate Like a Pro: Parse Logs Swiftly:

Skip the manual hassle! Use these commands for instant package details extraction:

sudo sed -n '/Commandline: apt-get install имя_пакета/,/End-Date:.*/p' /var/log/apt/history.log | sed -n '/Install.*/p' | sed -e s'/Install: //g' | sed -e s'/:amd64 //g' | sed -e s'/(.[^)]*),\{0,1\}//g' | tr '\n' ' '

Tip: Ensure accurate filtering to catch details from the latest installation.

sudo sed -n '/Commandline: apt-get install имя_пакета/,/End-Date:.*/p' /var/log/apt/history.log | sed -n '/Install.*/p' | sed -e s'/Install: //g' | sed -e s'/:amd64 //g' | sed -e s'/(.[^)]*),\{0,1\}//g' | tail -1

5. One-Command Clean Removal:

Become a master uninstaller with this ultimate removal command:

sudo sed -n '/Commandline: apt-get install имя_пакета/,/End-Date:.*/p' /var/log/apt/history.log | sed -n '/Install.*/p' | sed -e s'/Install: //g' | sed -e s'/:amd64 //g' | sed -e s'/(.[^)]*),\{0,1\}//g' | tr '\n' ' ' | sudo xargs apt-get autoremove --purge -y

Wrapping Up:

APT makes software management in Ubuntu a breeze when you’ve got the right commands at your fingertips. For more hands-on guidance, our video tutorial below is a must-watch.

Posted on 04.09.202330.05.2024 by sanglyb

Post navigation

← Master Remote Desktop in Ubuntu with X2go
ViewSonic VX2363SMHL: A Comprehensive IPS Monitor Review →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Подписывайтесь

Youtube
vk
telegram
github
twitter
rss
  • Форум
  • Об авторе
  • Поддержать автора

Популярные записи

Новые записи

  • How to Extend an LVM Partition in Linux
  • SCCM Reporting Errors After Migrating from SQL Server 2016 to 2019
  • Problem Using PassFiltEx on Older CPUs
  • How to remove attachments from old calendar events in Exchange using a script
  • How to download and install Office 2024 LTSC

Архивы

  • 2026 (3)
  • 2025 (5)
  • 2024 (7)
  • 2023 (30)
  • 2022 (4)
  • 2020 (17)
  • 2017 (82)
  • 2016 (5)
© 2015-2026 www.mytechnote.ru
Использование материалов сайта возможно только с разрешения владельца или обязательна индексируемая, прямая, передающая вес ссылка на материал.