Linux for Developers Course
Linux for Developers
/
Beginner

sudo

Definition

Superuser Do. A program that allows a permitted user to execute a command as the superuser (root) or another user, temporarily granting them ultimate administrative privileges.

Explain Like I'm New

The 'Simon Says' of Linux. If you try to install software, Linux says 'Permission Denied'. If you type `sudo install software`, Linux says 'Yes, Master' and does it.

Real World Example

You try to open the system password file by typing `cat /etc/shadow`. It fails. You type `sudo cat /etc/shadow`. It prompts for your personal password to verify it's really you, then opens the file.

Common Use Cases

  • •Installing software
  • •Modifying system files
  • •Managing users

Interview Questions

basic

  • When you use `sudo`, does it ask for your personal password, or the Root user's password?

intermediate

  • Why is `sudo` considered much safer than just logging in directly as the `root` user?

Flash Cards

Question

Which password?

Click to reveal answer
Answer

It asks for your own personal password to verify your identity.

Question

Why safer than root?

Click to reveal answer
Answer

Because `sudo` forces you to be explicit about dangerous commands, has a timeout (usually 15 minutes), and most importantly, it logs every single command you run to an audit file, so the company knows exactly who broke the server.