Hal concentrates on man(1), info(1), and apropos(1), and the --help flag. Good places to start, but there are other things worth mentioning.
So I will.
locate(1) is quite handy. I often find myself hunting for commands that don't have man entries of any kind, and are installed someplace bizarre. Once I find them, /path/to/command --help often tells me enough. If not, but they're in some special directory, there's sometimes a README or examples that do the trick.
Another frequent stop is the web. If command --help doesn't tell me what I want to know, the web's more likely to have a man page than my machine is. I'll now usually go there first.
If it's not an executable? How about type?
$ type lsls is aliased to `ls --color=auto'$ type cdjobcdjob is a functioncdjob (){local d;: ${1:?"usage $FUNCNAME %N"};d=$(jobs $1 | perl -lane 'print "cd $1" if m/.*\(wd: (.*)\).*/');test "$d" && eval $d}
And what's type?
$ type typetype is a shell builtin
For information about type, do we have to pour through the zillion-page, bash man page? On-line?
Nope. Watch:
$ man typeNo manual entry for type$ type typetype is a shell builtin$ help typetype: type [-afptP] name [name ...]Display information about command type.For each NAME, indicate how it would be interpreted if used as acommand name.Options:-a display all locations containing an executable named NAME;includes aliases, builtins, and functions, if and only ifthe `-p' option is not also used-f suppress shell function lookup-P force a PATH search for each NAME, even if it is an alias,builtin, or function, and returns the name of the disk filethat would be executed-p returns either the name of the disk file that would be executed,or nothing if `type -t NAME' would not return `file'.-t output a single word which is one of `alias', `keyword',`function', `builtin', `file' or `', if NAME is an alias, shellreserved word, shell function, shell builtin, disk file, or notfound, respectivelyArguments:NAME Command name to be interpreted.Exit Status:Returns success if all of the NAMEs are found; fails if any are not found.typeset: typeset [-aAfFilrtux] [-p] name[=value] ...Set variable values and attributes.Obsolete. See `help declare'.
Yes, there's really a help command. It gives help about shell builtins.
If I don't even have the command? (If, for example, it's part of someone else's script I've pulled down from somewhere?)
Here's what I get out of bash when I invoke als(1) on my Ubuntu box.
$ alsThe program 'als' is currently not installed. You can install it by typing:sudo apt-get install atoolals: command not found
Not help with the command, okay, but help getting it so I can then get help with it.
What would you pay? But wait. There's more.
If I guess at a command but mis-type it?
$ lasNo command 'las' found, did you mean:Command 'als' from package 'atool' (universe)Command 'ls' from package 'coreutils' (main)Command 'lfs' from package 'lustre-utils' (universe)Command 'lms' from package 'lms' (universe)Command 'les' from package 'atm-tools' (universe)Command 'last' from package 'sysvinit-utils' (main)Command 'laps' from package 'epix1' (universe)Command 'lvs' from package 'lvm2' (main)Command 'cas' from package 'amule-adunanza-utils' (universe)Command 'cas' from package 'amule-utils' (universe)Command 'as' from package 'binutils' (main)Command 'ras' from package 'ras' (universe)Command 'kas' from package 'openafs-kpasswd' (universe)Command 'lat' from package 'lat' (universe)las: command not found
I think that's nice. And I can use apt-cache show to tell me what each package is.
No comments:
Post a Comment