Problem description
I want
cd
arrive/etc/docker
, but it gives me oneInsufficient permissions
The error, then, I thought of usingsudo cd /etc/docker
When it told mesudo: cd: command not found
。
So, I was so depressed that I went online to find out the reason.
Problem analysis
cd
Not an application but a built-in command in Linux,sudo
Just work for the application.
sudo foo
It only means running the foo program with root permissions
so,sudo cd /etc/docker
Reportsudo: cd: command not found
。
verify
> type cd
cd is a shell builtin
Note that regarding whether cd is a built-in command, cd is not a built-in command in OS X 10.8 (refer towhat-is-the-point-of-the-cd-external-command), I don't know the specific version of OS X. Most Linux series (Ubuntu, CentOS and ArchLinux) have built-in commands
Solution
- use
sudo -i
Command to increase user permissions
> sudo -i
> cd /etc/docker
- use
sudo -s
Command to open a special shell
> sudo -s
> cd /etc/docker
All above can use the exit command to exit, or use the Ctrl+D shortcut key to exit
Reference article
- why-doesnt-sudo-cd-var-named-work
- how-can-i-cd-into-a-directory-as-root
- what-is-the-point-of-the-cd-external-command