How to run multiple commands in sudo under Linux or Unix
You can run multiple commands as sudo by separating the commands with a semicolon (;) or by using a shell script.
- Using semicolon:
sudo command1 ; sudo command2 ; sudo command3- Using a shell script:
sudo:#!/bin/bash
command1
command2
command3
chmod +x script.shrnsudo ./script.shNote: Running multiple commands as sudo can be dangerous, as it gives the commands elevated privileges. Make sure that the commands you run with sudo are safe and necessary.
