Advanced Commands: sudo - Superuser Do

sudo is commonly used to run a command as root.

You must be enabled to use sudo, and once you do, you can run commands as root by entering your user’s password (not the root user password).

The permissions are highly configurable, which is great especially in a multi-user server environment, and some users can be granted access to running specific commands through sudo.

For example you can edit a system configuration file:

sudo nano /etc/hosts

which would otherwise fail to save since you don’t have the permissions for it.

You can run sudo -i to start a shell as root:

You can use sudo to run commands as any user. root is the default, but use the -u option to specify another user:

sudo -u flavio ls /Users/flavio

The sudo command works on Linux, macOS, WSL, and anywhere you have a UNIX environment

Lessons in this unit:

0: Introduction
1: su - Switch User
2: ▶︎ sudo - Superuser Do
3: passwd - Change Password
4: ping - Test Network
5: traceroute - Trace Network Path
6: history - Command History
7: export - Set Environment Variables
8: crontab - Schedule Tasks
9: alias - Create Shortcuts
10: man - Manual Pages
11: tar - Archive Files
12: gzip - Compress Files
13: gunzip - Decompress Files
14: basename - Strip Directory
15: dirname - Extract Directory
16: nano - Text Editor
17: vim - Vi Improved Editor
18: emacs - Text Editor
19: ed - Line Editor

Join my AI Workshop!

The Web Development BOOTCAMP cohort starts in February 2026