Bash (shell)

Run multiple commands and kill them as one

use subshells with background commands.

(command1 & command2 & command3)

redirect sudo output

Run a shell with sudo and give the command to it by using the -c option

sudo sh -c 'ls -hal /root/ > /root/test.out'

Create a script with your commands and run that script with sudo

#!/bin/sh
ls -hal /root/ > /root/test.out
Written on August 17, 2019, Last update on August 30, 2019
bash cli shell