The sudo command


The sudo command

If you have come across Linux, you are probably aware of the command line. As you will find as you work through this book, Ubuntu puts a lot of reliance upon the sudo command while working at the command line. This command is used in front of other commands to tell Ubuntu that you want to run the specified command with super user powers. This sounds really special, and it actually is. When you work using the sudo command, you can make wide-ranging changes to your system that impact the way it runs. Be extra careful when running any command prefixed with sudo, however; a wrong option or incorrect command can have devastating consequences.

The use of sudo is straightforward. All you have to do is enter it like this:

$ sudo command commandoptions 


Just replace the word command with the command that you want to run, along with any options. For example, the following command opens your xorg.conf file in vi and enables you to make any changes as the super user before being able to save it:

$ sudo vi /etc/X11/xorg.conf 


Whenever you execute a command using sudo, you are prompted for your password. This is the same password that you use to log in to Ubuntu, so it is important that you remember it.

Sometimes, however, you may want to work with a classic root prompt instead of having to type sudo in front of every command (perhaps if you have to work with lots of commands at the command line that require super-user access, for example). sudo enables you to do this by using the sudo -i command. Again, you are prompted for your password, which you should enter, after which Ubuntu gives you the standard root prompt, as follows:

#


From here, you can execute any command without having to keep entering sudo.



Ubuntu Unleashed
Ubuntu Unleashed 2011 Edition: Covering 10.10 and 11.04 (6th Edition)
ISBN: 0672333449
EAN: 2147483647
Year: 2006
Pages: 318

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net