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?

muru
  • 193,181
  • 53
  • 473
  • 722
liv2hak
  • 267
  • 1
  • 2
  • 9

3 Answers3

0

You can't do cd like below,

sudo cd $pwd

But you can do,

sudo su
cd $pwd
Avinash Raj
  • 77,204
  • 56
  • 214
  • 254
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

user235984
  • 26
  • 1
0

thats because "cd" is a shell bullitin

don't worry it doesn't work for anyone

Meow
  • 1,357
  • 1
  • 12
  • 22