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
  • 197,895
  • 55
  • 485
  • 740
liv2hak
  • 267

3 Answers3

0

You can't do cd like below,

sudo cd $pwd

But you can do,

sudo su
cd $pwd
Avinash Raj
  • 78,556
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