You do not have to remember every flag. Most programs show a list of their flags when you give them the flag --help:
text
learner@tidepool:~$ head --help
head - output the first part of files
Usage: head [OPTION]... [FILE]...
Options:
-c, --bytes=NUM print the first NUM bytes
-n, --lines=NUM print the first NUM lines (default 10)
-q, --quiet never print headers giving file names
-v, --verbose always print headers giving file names
--help display this help and exitThe usage line
The usage line shows the parts of a correct line:
headthe command[OPTION]flags (OPTION)...can repeat[FILE]file names...can repeat
| Sign | Meaning |
|---|---|
[ ] | This part is optional |
... | This part can repeat |
OPTION | A flag |
The flag list
Each line of the flag list has the same parts:
-nshort form, --lineslong form=NUMtakes a valueprint the first NUM lines (default 10)what it does
(default 10) tells you what head does when you do not give the flag.
Find the flag you need
Read the right column. Look for the words that describe what you want. Then use the flag from the left column.
For example, to count the characters in a file, read wc --help. A character is one letter, number, space or sign.
text
-m, --chars print the character countsThe flag is -m, or --chars.