Sudo Command in Linux: Learn To Use It With Examples

Claudio Sabato
7 min readDec 4, 2023

Have you encountered the sudo command in Linux and wondered what it means? You are in the right place, you will find the answer here.

This guide explains what the sudo command is, a powerful tool in the Linux environment, essential for both beginners and experienced sysadmins.

Understanding the Basics: What is the Sudo Command in Linux?

In every Linux system, there is a user called ‘root’ also known as the administrator or superuser. This user has the highest level of control over the operating system. The term ‘root’ originates from the user’s ability to modify the root directory of a Linux (or Unix-like) system.

This guide explains why managing root access is crucial for system security and how the sudo command plays a pivotal role in this process.

Throughout this tutorial, you will execute Linux commands on the terminal so make sure you have access to a Linux system to practice with.

Why Restrict Linux Root Access is Important?

Imagine a Linux server providing hosting services to multiple users. Without restrictions, any user could potentially delete critical files or shut down the server.

This is where user permissions and limitations between the root user and non-root users come into play, forming the backbone of Linux’s security as a multi-user system.

Elevating User Privileges with the Linux Sudo Command

There are instances where a standard user might require temporary administrative powers. For example, installing specific software packages, such as RPMs, usually requires root access. Here’s where sudo becomes useful.

The acronym sudo stands for superuser do. The Linux sudo command allows specific commands to be executed with root privileges by non-root users without changing their identity and without specifying the root password. In Linux jargon, these privileges acquired using the sudo command are called elevated privileges.

Configuring Sudo: The /etc/sudoers File

--

--

Claudio Sabato

Claudio Sabato is an IT expert with over 15 years of professional experience in Python/Bash programming, Linux Systems Administration and IT Systems Design.