Hi Freddy,

Freddy Fisker wrote on Wed, Dec 13, 2017 at 10:22:32PM +0100:

> I can't get the manual to the cd (change working directory) command.

That is not a stand-alone command, but a shell built-in.
Actually, it is not even possible to implement it as a stand-alone
command because the effect of the intended change would end when
the command exits.

> When I am trying, I get the manual to cd (ATAPI and SCSI CD-ROM driver)
> instead.
> 
> It's the same with: man cd
> 
> and in: https://man.openbsd.org/cd

In general, when man(1) gives you the wrong section, specify the
section:

  $ man 1 cd
  https://man.openbsd.org/cd.1

Of course, in the specific case at hand, that won't help because no
such manual exists.

Your next try if a manual you are looking for does not exist should be
something like

  $ man -k any~^cd\$

See apropos(1) for details what "any", ~, ^, and $ mean.

That gives you about a dozen results, and the shell manuals you
are looking for are among them.

If you want less noise, you can guess that cd is probably some
kind of command, so a more specific try would be

  schwarze@isnote $ man -k Ic,Cm~^cd\$
  csh(1) - a shell (command interpreter) with C-like syntax
  ftp(1) - Internet file transfer program
  help(1) - help for new users and administrators
  ksh, rksh(1) - public domain Korn shell
  mail, Mail, mailx(1) - send and receive mail
  sftp(1) - secure file transfer program
  sh(1) - command language interpreter
  vi, ex, view(1) - text editors
  azalia(4) - generic High Definition Audio device
  fsdb(8) - FFS debugging/editing tool
  restore, rrestore(8) - restore files or file systems from backups...

You see, almost no false positives are left - ftp(1), sftp(1),
restore(1), and even vi(1) indeed have internal cd commands, too.

If you are completely desperate, you can even say

  $ man -ak Ic,Cm~^cd\$

to get all these manuals in your pager together, then type

  :tcd

inside less(1) to get to the first place where "cd" is defined,
then press just

  t

repeatedly to move on to the other places in turn.  Admittedly,
that way, it's a bit hard to see which manual you are looking at
at any specific time, but when you find an instance that pleases
you, you can type

  ?^NAME

inside less to see the start of the respective manual to see its
name.  After that, you can use the "t", "T", and "n" keys alternatingly
to move around among instance and see in which manual they are in.

So we just learned that at least nine different cd commands are
documented in various places, rather than cd not being documented
at all.  Which is the one you want to use?

Learn to use your documentation tools!  =:c)

Yours,
  Ingo

Reply via email to