Linux Command Line Interface (CLI) Install, Remove, Purge & Clean

4 months ago
5

Here’s a concise guide to managing packages using the Linux command line interface (CLI) with apt, including installation, removal, purging, and cleaning up:

1. Install a Package
To install a package, use the apt install command:

sudo apt update # Update the package list
sudo apt install {package} # Replace {package} with the package name

2. Remove a Package
To remove a package but keep its configuration files, use the apt remove command:

sudo apt remove {package} # Replace {package} with the package name

3. Purge a Package
To remove a package along with its configuration files, use the apt purge command:

sudo apt purge {package} # Replace {package} with the package name

4. Clean Up Unused Dependencies
After removing or purging packages, there may be unused dependencies that can be cleaned up using the apt autoremove command:

sudo apt autoremove

5. Clean Up Package Cache
To clean up the local repository of retrieved package files and free up disk space, use the apt clean command:

sudo apt clean

6. Verify Package Installation
To check if a package is installed and view its version, use the following:

{package} --version # Replace {package} with the package name

Summary of Commands:
Install: sudo apt update && sudo apt install {package}
Remove: sudo apt remove {package}
Purge: sudo apt purge {package}
Clean Up Dependencies: sudo apt autoremove
Clean Package Cache: sudo apt clean

These commands will help you manage packages efficiently on a Debian-based system.

Loading comments...