What exactly is sudo?
sudo stands for "Switch User and DO" or "SuperUser DO." It's the command that lets you run another user's commands — usually the administrator's. Linux has a super-powerful admin account called root that has permission to change anything on the system. The standard practice is to stay as a normal user and only borrow root privileges temporarily with sudo when you truly need them.
Windows and Mac have a similar concept: when you install new software, a prompt appears asking "Do you want to allow this app to make changes?" sudo is the Linux equivalent — you just type it instead of clicking a button.
How sudo works
When you run a command with sudo, it first asks for your password. Once authenticated, you can run additional sudo commands for a few minutes (15 by default) without re-entering your password. Closing the terminal resets the timer.
When do you need sudo?
sudo is only needed for "operations that affect the whole system." You don't need it — and shouldn't use it — for working inside your own home folder (/home/username/). Using sudo to tidy up your own files is like showing a police badge just to organize your personal notebook.
Recommended usage
Installing new software is the most common reason to use sudo. Example: sudo apt install python3 adds Python. The command means "tell apt (Ubuntu's package manager) to install python3." After installation, you run python3 without sudo.
Until you're comfortable, always read through commands you copy from the internet before running them with sudo. A command run with sudo cannot be undone.
For safe practice, start in WSL or a virtual machine where you can easily reset if something goes wrong. Before running any command, check its meaning with man commandname or commandname --help — especially for commands like rm, chmod, chown, and dd, which can make major changes to files or permissions.
Before reaching for sudo, ask yourself: "Is this just my own folder, or does it affect the whole system?" If it's only your files, sudo is not needed. Using sudo unnecessarily can make files root-owned, which means you won't be able to save them later as a regular user.
Traps to watch out for
- Commands like
sudo rm -rf /erase the entire OS. Don't just avoid running them — don't even paste them into your terminal. - Never run a command you found online that you don't understand with sudo. It could be a trap set by an attacker.
- Don't habitually prefix everything with sudo. Files will end up root-owned, making them a pain to manage later.
How will this help you in the future?
The idea behind sudo maps directly onto "the principle of least privilege" — a fundamental concept in security design. Run with weak permissions normally; borrow strong permissions only when necessary. This thinking is used everywhere in IT: AWS IAM policies, web admin panels, and corporate system design. Learning this mindset as a teen makes you someone who doesn't do dangerous things — a quality that earns trust in professional environments.
In server operations, it also matters that every use of administrator privileges is logged. sudo is not a convenient shortcut; it's a system that records elevated activity. Grasping this early will help you not just with Linux, but whenever you handle shared systems at school or work.
Start today
- Run
sudo apt updateon Ubuntu and experience the password prompt. - Install a fun tool with
sudo apt install cowsayand trycowsay hello. - Try opening the
/etc/hostsfile with and without sudo to feel the difference in permissions.
Summary
Check When do you use sudo?