0

How do I understand what the various options/flags mean?

For example:

1) uname -a - What does -a denote here?

2) pyang -f - What does -f denote here?

I just want to understand if there is some reference/doc that tells the usage of these? Please clarify.

2
  • 3
    For the first man uname. What is pyang? Commented Sep 3, 2016 at 15:02
  • pyang is library that validates the yang models
    – fsociety
    Commented Sep 3, 2016 at 15:13

2 Answers 2

1

With almost all Linux commands, I think the fastest and easiest first course of action is to append "--help" to the command. This gives you a good summary, which is often enough.

If you need more details, the man command is a good second choice.

For example:

$ uname --help

Usage: uname [OPTION]...  
Print certain system information.  With no OPTION, same as -s.

  -a, --all                print all information, in the following order,  
                             except omit -p and -i if unknown:  
  -s, --kernel-name        print the kernel name  
  -n, --nodename           print the network node hostname  
  -r, --kernel-release     print the kernel release  
  -v, --kernel-version     print the kernel version  
  -m, --machine            print the machine hardware name  
  -p, --processor          print the processor type (non-portable)  
  -i, --hardware-platform  print the hardware platform (non-portable)  
  -o, --operating-system   print the operating system  
      --help     display this help and exit  
      --version  output version information and exit  
6
  • 'command --help' works only with executables, not for shell builtin commands, functions and aliases...
    – Neni
    Commented Sep 3, 2016 at 16:53
  • @Neni - Well, not functions and aliases, of course, but builtins? Like ls, etc? Works with bash just fine. Commented Sep 3, 2016 at 16:54
  • 'read --help', 'cd --help', 'alias --help', ... doesn't work in bash. 'ls' is not a builtin, it is an executable, run: 'which ls'
    – Neni
    Commented Sep 3, 2016 at 16:58
  • @Neni - OK, fair enough. But the error actually prints out the usage, so it still is a quick way to try first. Commented Sep 3, 2016 at 17:01
  • 1
    I don't think this answer deserved a down vote. The OP specifically asked how to get information about uname and pyang and these are not builtins. Yes, an answer which also mentions builtins might seem more complete, but could also overwhelm someone asking such a question. Nothing wrong with this answer IMHO.
    – Hoov
    Commented Sep 3, 2016 at 17:23
1

In UNIX/Linux Shells, there are four different types of commands:

1. executables: compiled binaries or scripts
2. shell builtin commands
3. shell functions
4. aliases

If you encounter an unknown command, the first thing is to check its type. Let's examine a few examples for each type:

type <command>  # indicates the commands type
--------------
type find       # find is /usr/bin/find   --> executables
type cd         # cd is a shell builtin
type dequote    # dequote is a function
type ls         # ls is aliased to 'ls --color=auto'

Having the information of the command type, you can get help, description and usage of the command and it's options:

<command> --help   # help for executables     -->  find --help
help <command>     # help for shell builtins  -->  help cd

man <command>      # manual page for the specific command

Following commands are useful for information gathering as well.

whatis <command>   # display a very brief description of the command
which <command>    # display an executables location

In the example above, ls is aliased, but what is ls really?

whatis ls
help ls      # doesn't work --> ls is not a shell builtin command
ls --help    # works        --> ls is an executable / compiled binary
which ls     # /bin/ls      --> ls is an executable / compiled binary

There are thousands of commands to explore:

ls /bin       # list a few executables
ls /usr/bin   # list more executables
enable -p     # list all available shell builtin commands
declare -f    # list all defined functions
alias         # list all defined aliases

Now let's examine the uname command:

type uname    # uname is /bin/uname   --> executable
whatis uname
which uname
uname --help  # see the meanings of the options, e.g. -a
man uname     # read the manual page for uname

Do the same for the pyang command...

2
  • Kind of overwhelming for someone that is a rank beginner, though. The first several examples give no useful information for "uname", one of his specific topics, whereis my suggestion for a first try gives exactly what he wanted. Commented Sep 3, 2016 at 17:37
  • I didn't mean you, I meant the original poster. He is the one that may get overwhelmed by too much detail. I didn't intend to write a thesis on every possibility - I saw your answer, so I didn't need to duplicate your information, I thought it was more useful to add what I felt was missing. Sorry if you felt insulted. Commented Sep 3, 2016 at 17:47

You must log in to answer this question.

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