Results 1 to 4 of 4
ok well i am just trying to learn the linux filesystem in the shell so i have been pretty much just been running Code: cd /randomdirectory then running Code: ls ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-20-2011 #1
sudo and cd
so i try
sudo cd /root
oh btw i am running ubuntu 11.04 and i only have one user installed on the maching so su doesnt switch me to root.
- 10-20-2011 #2
- 10-20-2011 #3
"cd" is not really a program: instead, it is an action taken by a shell. The reason that sudo complains is that sudo only understands programs:
[alex@niamh ~]$ which cd which: no cd in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl)
[alex@niamh ~]$ whoami alex [alex@niamh ~]$ sudo -i [root@niamh ~]# whoami root
Instead, you can try something like "sudo ls /root", and therefore use sudo in its generally intended way.
- 10-20-2011 #4
There's another option for you, as well.
You can use su -c to perform root functions one at a time.
su -c 'ls -l /root