sudo and root
Admin powers.
Every Linux system has one special user called root. Root can do anything. Read any file, delete any file, change any setting. That's very powerful, and very dangerous. So normally, you borrow root's power for just one command, with sudo.

- root can do anything
- Powerful, and dangerous
- Borrow it with sudo
Normal user, then sudo
As Sam, we can't read the protected file slash ETC slash shadow. Permission denied. But with sudo in front, the command runs as root, and it works. Sudo head shows the first lines. Who am I, with sudo, even says root.
head -n 2 /etc/shadow head: cannot open '/etc/shadow' for reading: Permission denied sudo head -n 2 /etc/shadow root:*:20750:0:99999:7::: daemon:*:20750:0:99999:7::: sudo whoami root
How sudo works
Sudo means, super user do. When you use it, Linux usually asks for your own password, not root's, to prove it's really you. Only users in the sudo group are allowed. And every sudo command is written to a log, so there's a record of who did what.
Use it carefully
Sudo turns off all the safety nets. A typo with sudo RM can destroy the whole system. So use sudo only when you really need it, like installing software, or editing system settings. If a command works without sudo, don't add it.
| key | value |
|---|---|
| Use sudo for | installing, system settings |
| Not for | your own files |
| Danger | sudo rm -rf with a typo |
| Rule | only when needed |
Summary
Root can do anything. Sudo runs a single command as root, after checking your password. Use it only when you need to. Next, why you shouldn't just log in as root all the time.
Key takeaways- root = super user
- sudo cmd
- Only when needed