Opening an elevated command prompt


WARNING: Please read before continuing ▼

Difficulty: Easy
Time: varies
Last Updated: 29th November 2009
Applies to: OS X, Windows, *NIX

Often when performing system administration, you will come across a command that needs to be run as a more priviliged user. Depending on what operating system you use, the procedure for opening an elevated command prompt varies.

Windows:

On windows, opening an elevated command prompt is easy. Click the start menu, and type “cmd”. When “cmd.exe” appears in the list of results, ensure it is highlighted, and then press CTRL + SHIFT + ENTER. This will pop up a UAC prompt (if UAC is enabled) and then provide an administrative console.

Alternatively, you can right click “cmd.exe” and select “run as administrator”.

OS X:

By default, OS X has no super user enabled. You can perform various tricks to get access to this user account, but it is not needed. For most commands, you can simply use “sudo” to run any console command with full priviliges.

If you have a large amount to do however, you may want a persistent session, instead of working a command at a time. To do this, you can use “sudo -iH“.

-i instructs sudo to create an interactive session. -H instructs sudo to also change the HOME_DIR environment variable to that of the super user.

*NIX:

Depending on your distribution, you may or may not have the root account enabled. If you do, opening an elevated terminal is as simple as typing “su“. If not, you can always use “sudo -iH“, as with OS X.

If you are running a desktop environment such as KDE or GNOME, there are also typically GUI tools for running elevated terminals. On GNOME, you would do (the exact path to the terminal program may vary):

1
gksu /usr/local/bin/gnome-terminal

And for KDE:

1
kdesu /usr/bin/konsole

, , , , , , , ,

  1. No comments yet.
(will not be published)


Technical Procedures is Digg proof thanks to caching by WP Super Cache