General point today: Talk in more depth about things we've been using Note on typing commands: Remember rhythm with special characters Keep hands loose, like a bubble under your hand Use tab as soon as you can (prevents typos, validates input so far) A general note on special characters: Shell processing may change them! echo * Tilde, etc are also special. Book has a good list. single quotes are more powerful than double quotes Do you want that? Sometimes... Don't get mixed up here! shell != grep grep supports three types of regular expression! Command line grammar, example: grep -i note /usr/share/dict/american-english This will find all lines that contain the word "note" in either case inside the file /usr/share/dict/american-english Pieces and what they are, using examples from above: grep : The command to run -i : A flag, or option. These set options to commands. note : A parameter, or argument. Input to the command that is not a flag. For grep, this is the thing to search for /usr/share/dict/american-english Another parameter. For grep, this indicates the file to search How these appear in the manual Commands typically work like this. Where to specify in the command line: Generally speaking, flags can be specified in any order - Not all commands follow this Flags can usually be combined ( -i -r should be equivalent to -ir ) Some flags may require a parameter (-o outfile) - In that case, the parameter must follow the flag - Sometimes, no space is required (-lpthread) - Sometimes, it is used (-l pthread) There are short and long options - Short: -r -h - Long: --recursive --help - Generally, long options have two dashes Most commands support -h, -v, --help, or --verbose Not all, but it is very common If commands have a mandatory parameter, they will usually print out usage info without it Sometimes commands require that flags come before parameters Usually this is due to a variable number of parameters Can't always count on that, and not all commands with variable parameters require it A programming note: These appear as parameters to main in C/C++ - Example with argc and argv In Python, you can import argv Generally, if you are writing a command-line tool, you should support flags There are libraries to help with that! - Example: Python and argparse - For C: getopt and argp