MIAP Digital Literacy Command Line Guide

Learn about BASH commands!

View on GitHub

The sudo Command

Summary

The sudo command allows users to run programs with the security priviledges of another user. When trusted users precede an administrative command with sudo, they are prompted for their password. Once authenticated and assuming the command is permitted, the administrative command is executed as if by the root user.

Basic command structure

The basis format of the sudo command is as follows. For the description below, the dollar sign indicates that BASH command prompt.

$ sudo <command>

Note: If the user tries to run this command without including sudo and does not have the necessary permissions, the host system will return a message stating that access is denied. By including sudo, the user can now retrieve and edit the file’s contents at the privileged level.

Possible Flags

-p

The -p flag uses a custom password prompt with optional escape sequences.

-u

The -u flag is used when you want to run the command as a user other than the default target user (usually root).

Examples

Go back to the main list of commands