M HYPE SPLASH
// general

Can't cd to Desktop folder Mac commandline

By Sarah Scott

I am using OSX Lion and every time I tried to cd to my Desktop folder using "cd ~" and cd "Desktop" it stays in my home directory instead of going to Desktop. I've tried to perform the commands using sudo but it makes no difference.

Thanks.

7

1 Answer

Using the sudo command will grant access to any folder or file on the Mac.

The commands sudo cd ~ return and sudo cd Desktop return only appeared to fail. In fact, both commands succeeded but exited without any output.

To demonstrate this try the command sudo -i "cd ~;pwd"return which should print /var/root in the terminal window.

In order to use the same commands interactively, do following:

  1. sudo -i return
  2. cd ~ return
  3. pwd return

Output

/var/root

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy