Linux commands: sudo
A quick guide to the `sudo` command, used to run a command as another user
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
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
sudocommand works on Linux, macOS, WSL, and anywhere you have a UNIX environment
THE VALLEY OF CODE
THE WEB DEVELOPER's MANUAL
You might be interested in those things I do:
- Learn to code in THE VALLEY OF CODE, your your web development manual
- Find a ton of Web Development projects to learn modern tech stacks in practice in THE VALLEY OF CODE PRO
- I wrote 16 books for beginner software developers, DOWNLOAD THEM NOW
- Every year I organize a hands-on cohort course coding BOOTCAMP to teach you how to build a complex, modern Web Application in practice (next edition February-March-April-May 2024)
- Learn how to start a solopreneur business on the Internet with SOLO LAB (next edition in 2024)
- Find me on X