Skip to content
TrySitePrice

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

Best/Tutorial

nYou can run a command or script after apt-get by using the && operator. For example, if you want to install a package and then run a script, you can run the following command:
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.

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