2011/07/29

sudo Command Line Notes

I continue to enjoy the new Ubuntu 11.04 interface. I find it more keyboard friendly and can quickly launch applications from the keyboard by hitting the "windows/meta" key and typing in the first 2 or three letters of the application I want to launch. Today I did some research on the sudo command and this is what I learned.
  • sudo
    • run cmds as root, lasts for 15 mins and then you have to retype "sudo"
  • sudo !!
    • runs last cmd from terminal as sudo
    • usefull when you forget to add sudo before a cmd
  • sudo -i
    • enables a root shell, title bar will show root@[computer name]
    • type "quite" to disable root shell
    • created a new profile "sudo -i" to give my root shell a new background and font
      • this alerts me to be extra careful in this terminal window
      • I have to manually select my profile whenever I start a new root shell
    • Logging off
      • I close the window or tab for the root shell window
      • see sudo -k
      • I need help for command line method of logging out of root
  • sudo -k (I could not get this to work)
    • kills/stops persistant root authority
    • I could not get this to work. I still continued to be logged in as root@[computer name]

  • Create new terminal profile
    • from the terminal menu select > File/New Profile
    • a new window appears
      • profile name = sudo -i
      • based upon = [your user name] 'I did not need to change "based upon" setting
    • a new window "Editing Profile "sudo -i"" appears
      • Select "Colors" tab to change background and font color
      • select "Close" button to finish





Terminal with sudo profile (green background with yellow text)
Top window pane displaying  "root" user. 



Terminal with normal user "chad" profile.
Top window pane displaying "chad" user.



  • Definitions
    • shell = terminal window = command line window