Ubuntu – Sudo cannot do cd


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?

Best Answer

You can't do cd like below,

sudo cd $pwd

But you can do,

sudo su
cd $pwd