How do I run a command as root? [duplicate]

Solution 1:

If you have an administrator account, simply

sudo command 

runs commands as root after asking your password (for safety).

If your account is not an administrator account, you can't :-).

Notice: in a standard Ubuntu installation, the user you set up in the installation process is an administrator account. Guest account is not. Other users, depends on how you create them.

Notice too: "administrator" account in this context mean an account which has the privilege to become root. There is a lot more info in https://help.ubuntu.com/community/RootSudo and in https://help.ubuntu.com/community/Sudoers. I am using the simple "administrator account here" because it's how it's called in the graphic interface to create a new user:

Adding a user with administrative capabilities