The sudo
command in Linux allows users to run commands with superuser (root) privileges, enhancing security by limiting root access.
Examples:
- Run a command as root:
- Edit a system file:
- Switch to root shell:
- Execute as another user:
- View sudo privileges:
Use sudo
cautiously, as improper use can affect the system. Non-root users must be added to the /etc/sudoers
file or the sudo
group.