Skip to content
Advertisement

No man page for the cd command

Ubuntu Linux 15.10 – I just noticed that there is no man page for cd

This seems a bit strange.

I tried:

man cd

at the cmd line and I get back

No manual entry for cd

I was trying to find documentation on

cd -

which is super-handy for flipping between the last dir and the current dir

and cd --

which seems to be an alias for

cd ~

Am I missing something very obvious here, or should the man page be present?

Advertisement

Answer

cd is not a command, it’s built into your shell. This is necessary because your current working directory is controlled by the PWD environment variable named after the pwd or “print working directory” command.

The environment variables of a parent process cannot be changed by a child process. So if your shell ran /bin/cd which changed PWD it would only affect /bin/cd and anything it ran. It would not change the shell’s PWD.

Some systems, like OS X and CentOS, map the cd man page to builtin which lists all the shell built ins and lets you know you should look at your shell’s man page.

You can check what shell you have with echo $SHELL, it’s probably bash.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement