Example uses of the command "sudo"

A Brief Introduction

Man sitting at desk using computer
Andersen Ross/Stockbyte/Getty Images

The sudo command is frequently used to execute a command that requires root privileges. For example, if you want to run a shell script setup.sh that installs a program into a directory that only root can modify you can use sudo as follows:

sudo -u root ./setup.sh
sudo ls /usr/local/classified
sudo shutdown -r +20 "rebooting to fix network issue"