Complete Bundled APT Commands

Here's a list of bundled apt commands for different day-to-day tasks:

1. Basic System Update & Upgrade

(Updates package lists, upgrades all packages, and cleans up)

bash
Copy
Download
sudo apt-get update && \
sudo apt-get upgrade -y && \
sudo apt-get dist-upgrade -y && \
sudo apt-get autoremove -y && \
sudo apt-get autoclean

2. Full System Upgrade (Incl. Release Upgrade)

(For major version upgrades, e.g., Ubuntu 20.04 → 22.04)

bash
Copy
Download
sudo apt-get update && \
sudo apt-get upgrade -y && \
sudo apt-get dist-upgrade -y && \
sudo do-release-upgrade -y && \
sudo apt-get autoremove -y && \
sudo apt-get autoclean

3. Fix Broken Packages & Missing Dependencies

(Repairs broken installs and missing packages)

bash
Copy
Download
sudo apt-get update --fix-missing && \
sudo apt-get install -f && \
sudo dpkg --configure -a && \
sudo apt-get check

4. Clean Up System (Remove Junk Files)

(Removes cached packages, old kernels, and orphaned dependencies)

bash
Copy
Download
sudo apt-get autoremove -y --purge && \
sudo apt-get clean && \
sudo apt-get autoclean && \
sudo journalctl --vacuum-time=7d  # Cleans journal logs older than 7 days (optional)

5. Install Essential Build Tools (For Development/Kernel Modules)

(Sets up a system for compiling software/drivers)

bash
Copy
Download
sudo apt-get update && \
sudo apt-get install -y build-essential dkms module-assistant linux-headers-$(uname -r) && \
sudo m-a prepare

6. Remove Unwanted Packages Completely

(Purges packages + dependencies + config files)

bash
Copy
Download
sudo apt-get purge <package_name> -y && \
sudo apt-get autoremove -y --purge && \
sudo apt-get clean

(Replace <package_name> with the actual package.)


7. Check for Upgradable Packages & Security Updates

(Lists available updates without installing them)

bash
Copy
Download
sudo apt update && \
apt list --upgradable && \
sudo apt-get --just-print upgrade  # Simulates upgrade (dry run)

8. Batch Install Multiple Packages

(Installs multiple packages in one command)

bash
Copy
Download
sudo apt-get install -y package1 package2 package3

(Replace package1package2, etc., with actual package names.)


Notes on Usage

  • Use -y flag to auto-confirm prompts (useful for scripts).

  • For safety, test with --dry-run (simulation) before executing major changes.

  • Combine commands with && to ensure each step succeeds before proceeding.


Comments

Trending

The Significance of a Business Logo

SkillSeries From Learning to Delivering - Complete