I am curious to know what trick you use to remember options for various commands? Looking up man pages all the time is time consuming and not so cool!
6 Answers
The trick is simple: You just don't. It's a waste of time and just not necessary. Memorizing command options isn't a particularly useful skill. It's much more important to understand how stuff works in general and to have a vague idea which tools exist in the first place and what you use them for. A very important skill here is to know how to find out about stuff you don't know yet.
Man pages are time consuming? Not so. It's not like you have to read them - at least, not every time - there is a search function. So if I don't remember which cryptic option was the one for hdparm
to disable idle timer on some WD disks, I do man hdparm
and /idle3
and hey, it was -J
. Looking stuff like that up is so quick I don't even remember doing it afterwards.
Imagine someone actually memorizing all of the hdparm
options. What a waste of time.
It's fine if you just happen to remember options because you use them frequently. That happens automatically without even thinking about it. But actually consciously spending time on memorizing them... what's that supposed to be good for? A paper test?

- 48,978
-
4Upvoted: the skill is finding what you need, not rote memory.
man hdparm | less -p idle3
is also a handy way to jump to the desired term... – jasonwryan Aug 03 '14 at 23:31 -
I fully agree with this answer, though I think it's worth emphasizing that it is normal to have the few most common options to common programs memorized, just because you use them so often. Like
rm -i -f -r
,ln -s
,df -s -h
,cp -r -i
,ls -l -h -a
, etc. (the list varies from person to person). – David Z Aug 04 '14 at 02:41
Zsh has the run-help function, by default bound to Alth. With this function you can begin typing a command with many or complex options that are difficult to remember, like rsync
for example, and then have that command's man
page opened. So:
rsync Alth
read the man
page and work out which switches you require, hit q and then you are returned to your command prompt, exactly where you left off, ready to complete the command with the requisite options:
rysnc -azP file dir/
As the wiki notes:
The function can be further customized by defining helper functions of the form run-help-command. There are three such functions available in the standard distribution: run-help-git, run-help-svk, and run-help-svn.

- 73,126
-
Similarly
bash
hasbash-complete
which will supply a lot of parameter options for a lot of commands. – ericx Aug 03 '14 at 21:48 -
2@ericx "Similarly" might be overstating it a little... Zsh also has completion, this is a step up from that. – jasonwryan Aug 03 '14 at 22:01
-
-
@ericx, also,
bash
's completion doesn't support adding descriptions to the completion list, or grouping entries (--classify -F -- append file type indicators
for example in zsh's GNU ls completion) so is not nearly as useful as zsh's. – Stéphane Chazelas Aug 05 '14 at 11:10 -
** root@milicent ** ~/tmp ** Tue Aug 05 09:24:55
pkg info
(-e -d -f -l -o -p -D)-r[Displays the reverse dependencies] (-e -d -r -f -o -p -D)-l[Displays all files] (-e -d -r -l -f -p -D)-o[Displays origin] (-e -d -r -l -o -f -D)-p[Displays prefix] (-e -d -r -l -o -p -D)-f[Displays full information] (-e -d -r -l -o -p -f)-D[Displays message] (-e -f -r -l -o -p -D)-d[Displays the dependencies] (-f -d -r -l -o -p -D)-e[Returns 0 if
– ericx Aug 05 '14 at 13:26is installed] (-g -X -a -F)-x[Process packages that match the regex pattern] (-g -x -X -F)-a[Process all package -
@ericx,
bind -p | grep bash-complete
shows no results on archlinux. is it a custom (framework) function? – Feb 10 '18 at 17:35
Most commands have --help for quick reference, and it is usually enough to remind what was something that I used to know.
That said, have a habit of writing --help instead of -h or even -?. You never know what -h is before looking usage output or manual page. In worst case the -h might be short hand for --hazardous-automatic-destruction.
-
2...Most commands on GNU systems. commands on Unix systems typically don't have
--help
.-?
needs quoting withzsh
,csh
,tcsh
orfish
or if there are files whose name are-
followed by a single character in the current directory.-:
may be preferable there. – Stéphane Chazelas Aug 03 '14 at 21:25 -
Well.. many non GNU systems has so appalling usage outputs they are pointless to even look. In such case see man pages & best of luck memorizing by hard coz nothing else will work. – kerolasa Aug 03 '14 at 22:29
-
Using a very long command history, and seaching through it, is very useful.
I basically collect all shell history files, and grep through them.
The results found are in many cases very useful, as it's easy to seach for good keywords.
Searching for a speciffic argument you used, like an URL, you find the related commands and options too. And searching for speciffic options, you may find relevant arguments too.

- 17,283
One option I like is to create aliases that have the same or similar options, e.g.
alias rmi='rm -i'
alias rmiv='rm -iv'
alias rmv='rm -v'
alias cpr='cp -r'
alias cprv='cp -rv'
This way you have a nice shortcut that you'll soon remember easily but that will also retain information about the actual option(s) it reflects.
Another approach with aliases is to pick the most common options and make a super short alias that uses them. For instance for ls
I nearly always do l
and that is because I have:
alias l='ls -alFtrG'
Another option is to just bring in the the options you like to the base command, e.g.
alias ls='ls -F --color=always'
Finally practice, practice, practice and patience. Keep typing common options and you will eventually learn them. The common ones in days, others in weeks and yes some take years to become known to you. Think of that as a treat in that unix programming will continue to entertain you for a long time.
Another option that I like is an alias to make searching my history easier and for that I have two similar aliases:
alias hg='history | tail -200 | grep -i'
alias hga='history | grep -i'
These let me search for uses of a command for instance:
hg ls
will show any recent uses of ls from history
hga ls
will show all uses of ls from my entire history.
I developed hg after finding that hga tended to show too much.

- 42,013
-
4If OP can't remember what
rm -iv
does, OP probably also won't remember whatrmiv
does. I don't think it's the hyphen that's the problem. – tobyink Aug 04 '14 at 00:15 -
-
Thank you guys! I guess i was worrying to much for remembering more than learning more..I shall learn when to use the weapon instead of learning what is the bullet dimensions and velocity! Lucky to have so many good linux folks here.. Cheers to unix/linux!! – Atul Aug 05 '14 at 21:57
I typically do:
man ${CMD} | grep 'what was I thinking about?'
Or some variation thereof. With some grep
s you can specify -C/A/B for context, after, and before respectively. If not, nl
and sed
can be pretty well matched:
man hdparm | #hard to forget
nl -bp'idle3' -nln -w1 | #I had to grep man to put this together
sed -n '/^[0-9]/{N;N;N;s///p}' #no print until line begins w/ number, next,next,next
Drive's "idle3" timeout value. This timeout
controls how often the drive parks its heads
and enters a low power consumption state.
The factory default is eight (8) seconds,
zero (0) to disable the WD idle3 timer com‐
pletely (NOT RECOMMENDED!).
-k Get/set the "keep_settings_over_reset" flag
The same techniques work with --help
menus if you have them, but you might need to do a ${CMD} --help 2>&1 | ..filter..
because is a fairly standard practice to print such things to stderr
.
Anyway, I guess the moral of the story is, remember at least man
and grep
. Maybe don't sweat the rest.

- 58,310
-
1+1. I often
grep
man pages when looking for a particular feature, that's pretty handy. – John WH Smith Aug 04 '14 at 21:10 -
grep's
-A
-B
-C
options can be useful too, egman bash | grep -A 25 PROMPTING$
– Feb 10 '18 at 17:39
zsh
. – Stéphane Chazelas Aug 03 '14 at 20:26man
pages is very cool... :) – jasonwryan Aug 03 '14 at 21:32netstat -tuna
andperl -pi -e
(Perl Pie!!) :) – Joseph R. Aug 04 '14 at 22:54man
remembered all of them, so just ask him for the help. – αғsнιη Jan 22 '20 at 04:56