Command-Line – How to Write a Shell Script to Install a List of Applications

aptcommand linescripts

Does anyone know how to write a shell script to install a list of applications? It's a pain to have to install each application by hand every time I set up a new system.

Edit:
It still asks me Do you want to continue [Y/n]?. Is there a way to have the script input y or for it not to prompt for input?

Best Answer

I would assume the script would look something like this:

#!/bin/sh
apt-get update  # To get the latest package lists
apt-get install <package name> -y
#etc.

Just save that as something like install_my_apps.sh, change the file's properties to make it executable, and run it from the command line as root.

(Edit: The -y tells apt-get not to prompt you and just get on with installing)