0

I want to see a list of all possible options for a specific command line tool. The --help option can be useful, but might not include all the options and sometimes you just need a list instead of a detailed description. Basically the bash equivalent of dir() in python.

For example:

The command python --help pulls up a description of options/arguments. However it doesn't include options such as python --version. Does bash have a way to check this?

4
  • You can't, because the options aren't something that exist in a queryable form; the program has to be written to report on what options it will work on. Commented Jan 31, 2019 at 23:22
  • I think you're confused. By "bash function" perhaps you mean any command line utility you can run from a terminal? if so, they're not part of bash they're standalone applications written by various authors that happen to use the same flag --help to print some useful info. man is the typical *nix utility for getting more verbose info on a command otherwise search the internet for docs on the command Commented Jan 31, 2019 at 23:43
  • @stacksonstacks Yes I wasn't sure what to call it, but I've updated the question to say 'command line tool' instead. Commented Jan 31, 2019 at 23:46
  • 1
    another useful tool is tldr Commented Jan 31, 2019 at 23:50

1 Answer 1

2

It depends on what you're trying to get help on.

For an executable like python your best bet is the man page. This is only really available on Unix though. eg.

man python

This brings up a screen that looks like:

PYTHON(1)                   General Commands Manual                  PYTHON(1)

NAME
       python  - an interpreted, interactive, object-oriented programming lan‐
       guage

SYNOPSIS
       python [ -B ] [ -d ] [ -E ] [ -h ] [ -i ] [ -m module-name ]
              [ -O ] [ -OO ] [ -R ] [ -Q argument ] [ -s ] [ -S ] [ -t ] [ -u ]
              [ -v ] [ -V ] [ -W argument ] [ -x ] [ -3 ] [ -?  ]
              [ -c command | script | - ] [ arguments ]

DESCRIPTION
       Python is an interpreted, interactive, object-oriented programming lan‐
       guage that ...

COMMAND LINE OPTIONS
       ...

       -V ,  --version
              Prints the Python version number of the executable and exits.
       ...

This uses a program called less to display the information. You can scroll with the arrow keys and quit with q. There are more commands available in less. Type man less to find out more.

If you're looking for help on a bash builtin (eg. echo) try the bash builtin help eg.

help echo
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.