How to run a command or script after running apt-get command on a Debian or Ubuntu Linux

sudo apt-get install <package-name> && <path-to-script>

This will install the package, and if the installation is successful, it will run the script. If the installation fails, the script will not run.

You can also run a command in the background while apt-get continues to run by appending an ampersand & symbol to the command:

sudo apt-get install <package-name> ; <command> &

Note that the semicolon ; is used to separate the two commands, and the ampersand & is used to run the second command in the background.

(https://uk.godaddy.com/)

Leave a Comment