How to Download Packages Using APT Without Installing Them
When you need a .deb file on hand but don’t want your system to change right away, you can grab the package with APT and keep it sitting in a folder. This trick saves bandwidth for future installs, lets you inspect or copy the file elsewhere, or sidestep a broken dependency that would otherwise trigger an auto‑install.
Why You Might Want to Do This
I’ve seen this happen after a bad driver update: the installer pulls in a new kernel module but then refuses because another package is missing. If you’re troubleshooting, it helps to pull the missing piece first and hand‑off the file to whoever needs it without messing with your current environment.
The Simple Apt Download Command
Run:
sudo apt-get download <package-name>
apt-get download pulls just the .deb file and leaves everything else untouched. Unlike apt install, no dependency tree is resolved, so you stay out of your system’s hands.
Using Apt Cache for Offline Use
If you’ve already installed a package but want its file later:
dpkg -L <package-name> | grep .deb$
Then copy it from /var/cache/apt/archives/. The cache holds all downloaded packages, so you can grab the exact version that was used on your machine.
Fetching Dependencies Without Installing
Sometimes you need a package plus its prerequisites but don’t want to install them yet. Use apt-cache depends to list deps:
apt-cache depends <package-name>
Then download each one individually with apt-get download. Wrap the loop in a script if you have many dependencies.
Cleaning Up After You’re Done
When your stash is full, clear out the cache to reclaim space:
sudo apt-get clean
This deletes all files in /var/cache/apt/archives, but your manually copied .deb files remain safe wherever you moved them.
Give it a try and keep those packages in your toolbox.