Why cat, grep and other commands can’t understand files starting with minus sign?

If I have a file which name starting with single or several minus sign, for example –1 it can’t be used as a parameter of many commands. Even if I run cat –1 instead of file content I get unrecognised option error message: cat: unrecognized option '–1' Same effect appears when I type cat "–1" … Read more

How do I find number of vertical lines available in the terminal?

I’m writing a script which shows the git log for a directory when I cd into it. Such a log can be overwhelming, containing hundreds of lines. So far I have been limiting that to a hard-coded 20 lines (... | head -n 20), which is fine on the screen at work, but too much on the smaller MacBook screen at home.