after reinstall system I need install applications again. Is it possible to make bash script or own package where cancan I add needed application and after reinstall system will I install them all using one command?


3 Answers 3


To build a list of installed packages use:

sudo dpkg --get-selections > package.list

To restore the packages use:

sudo dpkg --set-selections < package.list
sudo apt-get dselect-upgrade

You can use sudo apt install app1 app2 app3 type command in order to install multiple applications from the terminal or a bash script. Simply list all of the applications you wish to install in that command.

For example, if I wanted to install the applications gufw, libreoffice and hexchat, I would simply run the command sudo apt install gufw libreoffice hexchat.

Make sure you use the correct package name for each one because if any one of the package names in the command are misspelled or incorrect, the entire command will fail.


If the packages come from apt repositories , it is sufficient to provide a long list on command line

sudo apt install pkg1 pkg2 pkg3

If the list is large you may run into argument list too long error. In such case you can create a text file with list of packages one per line and run something like

sudo xargs --arg-file packages.txt apt install

Remember to update package cache before installing

sudo apt update

For deb packages found locally on disk, you could use sudo dpkg -i ./*.deb in current working directory or sudo dpkg -R -i debfiles/ to recursively traverse debfiles/ directory ( user-defined , can be replaced with another name). However, there are issues when those packages may need dependencies first, and the linked post provides a Python script to resolve that via topological sort.

Not the answer you're looking for? Browse other questions tagged .