kdmurray.blog

The crossroads of life and tech

Ubuntu School – sudo Your Last Command

Sometimes we just forget that we need to specify elevated privileges on our Ubuntu machines. I do it all the time, particularly when I’m setting up a new machine.

Thankfully there’s a shortcut for those of us who are forgetful. If I want to restart the box I can use a command like:

shutdown -r now

But of course that command requires elevated privileges:

shutdown: Need to be root

With the fantastic !! argument for sudo you can repeat your last terminal command:

sudo !!

Now you can quickly and efficiently re-run that last command you forgot to sudo!!

Hide the Undock Button in Windows XP in Five Steps

If you have a Windows XP notebook, and love to use the Run menu item, chances are you’ve occasionally hit “E” instead of  “R” when you bring up your start menu.  The result? Windows ejects the PC from it’s dock and forces you to re-dock it before you can carry on with your work.  It’s only about a 90-second process, but it’s annoying as hell and will completely take you ‘out of the zone’ when you’re in the middle of your project.

  1. Open the registry editor (Start -> Run -> regedit)
  2. Open one of the applicable keys:
    • Current User: [HKCUSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer]
    • All Users: [HKLMSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer]
  3. Right-click the Explorer folder -> New -> DWORD Value and call it NoStartMenuEjectPC (case-sensitive!)
  4. Right-click NoStartMenuEjectPC -> Modify
  5. Choose one of the following values to set the behaviour you want:
    • type 1 to hide the undock button
    • type 0 to show the undock button

Now you can safely use your keyboard shortcuts without worrying about accidentally undocking your computer.