Quickly Add/Remove Multiple packages with apt-get (command line hackery)

This is a simply yet effective way I personally add/remove packages in ubuntu when I change distro's and need to reinstall everything other than aptoncd which I have an article for, my site search will bring it up searching for "aptoncd". Basically the idea is to add all your favorite packages to a text file and install them all with a simple command as well as removing them:

simply make a text file with packages you like after you add the right repositories, I simply:

echo "deb repository.com repo/">>/etc/apt/sources.list

to add repositories via the terminal
Now make a list like this:
pidgin
opera
firefox
and-any-package you need, save it in a safe location named aptfiles.txt
Now to simply restore/install your list do:
cat aptfiles.txt | xargs sudo apt-get -y install
Now you can also make a list to remove files you dont need named apt-remove.txt
Do the same:
cat apt-remove.txt | xargs sudo apt-get -y remove

I hope you enjoy this simple apt-get trick as much as I do, feel free to add any tips/tricks of your own in the comments.
d e f c o n

Comments (2)

Loading... Logging you in...
  • Logged in as
thanks, yup :)
Yes but what does this help really? For short lists of packages just do a "apt-get install package1 package2 etc.."

And for a complete backup list of the packaged you have _manually_ chosen to install (perfect to install everything again after a reinstall), install "debfoster" and run it. Devote 30min to going through the packages to only keep the ones you really use or just tell it to keep them all for a complete list.

Post a new comment

Comments by

Clicky Web Analytics