sudo execute multiple commands with superuser/root permission

The longer way of executing multiple command with root permissions is to put all the commands into a script and then executing the script using sudo. However if you want to avoid doing that for something quick, the following command construct could be used.

sudo sh -c "whoami; whoami"

About Pratik Sinha

Linux Nerd, Socialist, Atheist, Adventuristic, Nature Lover, Geeky.

Leave a Reply