16

man echo works. but out of curiosity, does echo have something similar to a --help flag/parameter?

2
  • How about you simply try and see if it works?
    – Oxwivi
    Feb 21, 2011 at 7:43
  • 6
    I have tried it, Sir. and hence the question. Have edited it now to make it less confusing. Feb 21, 2011 at 7:43

4 Answers 4

21
+50

Assuming you are using bash, echo is a shell builtin (which you can see by running type echo). That means the man-page you want to read is man bash. Or you can get help on bash builtins and keywords with the help builtin, e.g. help echo.

The information you see when you run man echo, is for the external echo command, installed by GNU coreutils. (type -a echo).

To learn bash, read http://mywiki.wooledge.org/BashGuide

9

There are two echo The built-in command and another one, an executable placed in /bin/echo

The built-in (this is the default one) hasn't any help options far beyond the help echo built-in. Any flags placed and not listed there are presented as command result and there's no help command.

In the executable version instead /bin/echo there's a --help flag which prints usage. but you must call /bin/echo explicit.

5

Other way would be using whatis bash command for example.

whatis echo             >>>> shows as following 

echo (1)             - display a line of text

According to Whatis manpage , it displays manual page descriptions. Such as

 whatis whatis
whatis (1)           - display manual page descriptions

For Commands brief parameters or options try --usage infront of them as

whatis --usage
Usage: whatis [-dvrwl?V] [-C FILE] [-L LOCALE] [-m SYSTEM] [-M PATH] [-s LIST]
            [--debug] [--verbose] [--regex] [--wildcard] [--long]
            [--config-file=FILE] [--locale=LOCALE] [--systems=SYSTEM]
            [--manpath=PATH] [--sections=LIST] [--section=LIST] [--help]
            [--usage] [--version] KEYWORD...

Another excellent source is Ubuntu Manuals a.k.a manpage, just type to search what you want.

A suggestion if you try whatis in terminal and press Tab key successfully it will show

Display all 9747 possibilities? (y or n)

You can experiment depending on above possibilities.

Also there is apropos similar to man -k keyword use to search the manual page names and descriptions.

You can also use whereis to locate the binary, source, and manual page files of a command as

whatis whereis
whereis (1)          - locate the binary, source, and manual page files for a command

Official references

You can refer this Extensive and excellent source at Ubuntu Command Line Wiki page such as [7. Beginners/BashScripting].

Refer GNU Shell Built-in Commands guide

For External Source refer

An A-Z Index of the Bash command line for Linux explaining examples and Usage .

O'reilly Linux Command Directory from Linux in a Nutshell, 5th Edition book

0

You could use the help command, as this is a bash builtin, this is a lot of help while scripting

[11:16:07 oyrm ~]$ help
GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
....

This banner is followed by a list of commands, as indicated in the banner. Try out

help echo

and I think you'll see that this is a nice, concise description of the application of the shell command

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .