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

Peter Otten __peter__ at web.de
Thu Aug 23 15:51:00 CEST 2012


Cecilia Chavana-Bryant wrote:

> Hola,
> 
> I'm going through the 'Command line crash course' by Zed Shaw, thanks to
> the people that recommended this book, its quite a good course, I can see
> what the author was going for with the title but if it wasn't for your
> recommendations, it would have put me off. At the beginning of Chapter 8 -
> Moving around (pushd, popd) on Source: 13 exercise 8 I found this command:
> mkdir -p i/like/icecream. I am guessing that the -p stands for directory
> path? 

Arguments like -p or --parents are options that change the behaviour of a 
command or allow you to pass optional arguments to it.

$ mkdir i/like/icecream

will fail unless the directories i and i/like already exist. The leaf 
directory i/like/icecream must not yet exist.

If the -p option is provided

$ mkdir -p i/like/icecream 

will silently create all intermediate (or "parent", hence the abbreviation) 
directories and not complain if a directory i/like/icream already exists. 
You can see

$ mkdir -p i/like/icecream

as a shortcut for

$ mkdir i
$ mkdir i/like
$ mkdir i/like/icecream

> 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 find a list of these with descriptions of what they do. I have
> tried
> googling with no positive results as I don't  know what they are called or
> I get just the information for the command they are used with.

For every shell command there is a "manpage" that describes what the command 
does and what options it will accept. You can display the manpage for mkdir 
with

$ man mkdir

> Many thanks in advance for the help, Cecilia

Well, here is the place for basic help, but it should normally be about 
Python...



More information about the Tutor mailing list