12 ms·
I love the command line and use it all the time. But let's be honest, the design is pretty esoteric. You want to find a file containing a particular string? F
by michaelt 6y ago
I love the command line and use it all the time.
But let's be honest, the design is pretty esoteric.
You want to find a file containing a particular string? For some reason the tool is called 'grep'. The name is followed by '-r' then the search term, then the directory to start the search in.
And it won't be long before you start encountering tools with such intuitive names as 'sed' and 'awk' and 'crontab'
The tool for finding a file by name is better - that's called 'find' - except compared to grep the arguments are swapped: The directory to search is now the first parameter, not the last.
Oh, to find the *.desktop files on your system you did a find on / ? Yes, the messages like "find: ‘/proc/19917/fd’: Permission denied" are normal, you should ignore them. It's easy, simply add 2>/dev/null to the command.
Before you know it, the command line infects your brain and you start saying things like "sudo and nohup are perfectly good names"
- ywei3410 6y agoTo be honest the criteria for a beginner and someone who's used a tool for a while are different. You bet that `ls`/`cd` is a great name for me - it takes 2 characters and I don't have anything similar conflicting on the PATH. For a beginner? Not so much - `change-directory` and `list-directory` would probably be better. It's the same with regular expressions `^[A-Z0-9]{0, 3}$` is perfectly readable once you're reasonably familiar with the syntax. It's also true in other fields such as mathematics or music - the notation is quite good once you're proficient in it.
- kellyjprice 6y agoOh oh. I read the HN article about why it's called `grep`. g - global re - regex p - print https://en.wikipedia.org/wiki/Grep#:~:text=Its%20name%20comes%20from%20the,others%20such%20as%20OS%2D9 https://en.wikipedia.org/wiki/Grep#:~:text=Its%20name%20come....