Difference between 'man ls' and 'ls --help'?

For one, --help is not a command, it is an argument that is often given to a command to get help using it. Meanwhile, man is a command, short for "manual". Manual pages are installed by many programs, and are a common way to find help about commands, as well as system calls, (e.g. fork()).

If a program installs a manual page, it can always be accessed via the man command, whereas --help is just a common convention, but need not be enforced—it could be just (and only) -h.

man also typically uses a pager, such as less, automatically, which can make viewing and searching through the information much easier.

Finally, you mention Bash programming in your question—none of this is unique to Bash. Bash doesn't care about the commands themselves or their arguments for the most part.


In most scenarios man is more detailed than --help. help gives the command line options for a particular command. But man is a lot more detailed.

Plus man is a command-line tool in itself whereas --help is a command-line arg for a tool. Small difference.


In the first you asking the system to search the manual pages for help on the command. The second you are asking the command to provide its own help. The two will most certainly differ - usually the command provides a reminder of its options where as the man page is a detailed description.

Tags:

Linux

Shell