Every time I use grep and find I'm stumbling through, which order I should type the commands: When I should write the path and when I should write the flags, if it needs double quotations or not, etc. etc.
I've Googled it many more times than I'm proud of.
For grep
# Searching all files in the directory (recursively)
grep -rni "string" *
# Disecting it
command flags parameter path
-------------------------------
grep -rni "string" *
For find
# Searching for a file by name
find . -type f -name "file-name*"
# Disecting it
command path flag parameter flag parameter
-------------------------------------------
find . -type f -name "file-name*"
Are there a good way of remembering, when the path should come and when the flags should come etc. (without simply Googling it every time)?
Solution attempt 1: man pages
I love the man-pages, but maybe I'm using them incorrectly. They are detailed (which is good), but if I want to get a quick example with, how to use the given command, then I struggle with the man-pages.
If I write man find, I can see this close to the top:
SYNOPSIS
find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point...] [expression]
Solution attempt 2: Save snippet-examples that I use a lot
I can also simply save snippets that I use a lot, so I quickly can load a working example.
But what do other people do here? Is this intuitive for everyone else?