1

I found the strangest thing

sudo cd $pwd
sudo: cd: command not found

I am able to cd as a normal user.It seems that PATH is not set properly for su.

How do I fix that?

1
  • cd is not a program but an in-built command and sudo only applies to programs Feb 11, 2014 at 6:34

3 Answers 3

0

You can't do cd like below,

sudo cd $pwd

But you can do,

sudo su
cd $pwd
1
  • sudo -i is the cleaner way of doing it.
    – frlan
    Feb 11, 2014 at 8:12
0

You don't change directory as sudo.

sudo = Superuser Do [something]

what you can do is login as a superUser

sudo su

do what you want (change directory, execute, edite file, etc). eg:

cd [the_directory]

when you are done. logout superUser:

exit

2
  • i think sudo means substitute user(rather than super user)
    – Meow
    Feb 11, 2014 at 6:26
  • Instead of sudo su you should do sudo -i
    – frlan
    Feb 11, 2014 at 8:11
0

thats because "cd" is a shell bullitin

don't worry it doesn't work for anyone

Not the answer you're looking for? Browse other questions tagged .