sudo
Run a command with admin rights
What it does
sudo runs the command after it as root, the user who can do anything: edit system files, install packages, manage services. It asks for your own password, not root's, and then does not ask again for a while (15 minutes on Ubuntu).
Only users who are allowed to can use sudo: on Ubuntu and Debian, members of the sudo group. Forgot to type sudo? Repeat the last command with sudo !!. sudo -u <user> runs a command as another user instead of root.
Careful. With sudo the system no longer protects you from mistakes: a typo in a path given to rm, chmod or chown can break the server. Reread the command before pressing Enter, and do not add sudo "just in case" where it is not needed.
Syntax
sudo <command>
sudo -u <user> <command>
sudo !!Examples
Open /etc/hosts in the nano editor with admin rights
sudo nano /etc/hostssudo— run as rootnano— a simple terminal editor/etc/hosts— a system file, read-only for regular users