Using sudo at the command line

When working with terminals (Applications → Accessories → Terminal), any command can be run as an administrator by typing sudo before it.

Sudo will remember your password for a set amount of time; by default this is 15 minutes, but can be changed. This feature was designed to allow users to perform multiple administrative tasks without being asked for a password each time.

If the program you wish to run as an administrator is graphical, such as the Gnome text editor (Applications → Accessories → Text Editor), you should use the command gksudo followed by the command you wish to run.

[Caution]

Be careful when using sudo; you might damage your system if you type the wrong command! As a general rule, only use sudo when absolutely necessary.

When you use sudo from a terminal, be sure to close it when you have finished!

For more information on the sudo program see the sudo page on the Ubuntu wiki.