[Tutor] What are all those letters after terminal commands?

David Rock david at graniteweb.com
Thu Aug 23 15:47:14 CEST 2012


* Cecilia Chavana-Bryant <cecilia.chavana at gmail.com> [2012-08-23 14:18]:
> mkdir -p i/like/icecream. I am guessing that the -p stands for directory
> path? I have seen other such letters sometimes with or without the ' - '
> before them (I think) in commands so my question is, what are these letters
> for? what are they called? and could someone please point me to where I can

They are called commandline options.  Most programs allow you to use
options to change the behavior of the program "on the fly."  In this
particular case, mkdir creates a directory, while mkdir -p means "make
the directory and any parent directories that do not already exist.  For
example:

If i/like/icecream does not exist, we try to create it with mkdir:
  mkdir i/like/icecream

The result will be an error if i or i/like does not exist yet:
  mkdir: i/like: No such file or directory

So we use -p, to also create the parent directories:
  mkdir -p i/like/icecream

To learn about options that are available for a given command, try using
the "man" command like so:
  man mkdir

It will give you a list of options, what they do, and how to use them.

In general, there are two things you can use on a commandline, options
and arguments.  Options are the switches that change the program's
behavior and arguments are the inputs to the program (filenames, etc).

-- 
David Rock
david at graniteweb.com


More information about the Tutor mailing list