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:
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

Clicky Web Analytics