How do you remember command options?

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?


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.

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.

Tags:

Shell

Command