Hacker News new | past | comments | ask | show | jobs | submit login

If you're just trying to locate a file in the current directory, you should probably be using find.



I remain convinced that "find" also contains a text editor and a Pacman game, but I've never cared enough to read the damn enormous man page. Also, not every system has "find", but everything I've used has "du" and "grep".


Just for definiteness, the equivalent "find" idiom would be:

  % find . -path '*foo*'
You need -path, not just -name, to match the whole name as du does.


I'll point out that the find command is 21 characters, while mine is only 17. Efficiency!


Yes, you have a point (plus, those stars, they burn the eyes).

But, your detractors will say yours is two processes and theirs is one. Efficiency!


The kernel could start 100 processes in the time it takes me to type those extra four characters. We won't run out of processes. I did a test, finding .txt files in /usr/share, it took about .25 seconds longer with du and grep, which seems like less than it takes to type 4 more characters.


How long does it take you to type a character???


Assume I type 80 wpm

A word is standardized as 5 keystrokes

80 wpm is therefore 400 keystrokes per minute.

Divide by 60 to get about 6.6 keystrokes per second, or about 0.15 seconds per keystroke.

Therefore it would take about 0.6 seconds to type the four extra characters, giving a net savings to use du+grep instead.

And 80 wpm is probably a rather fast estimate; I'd guess that I type slower when I'm writing commands than when I'm entering English text.


I must've read it wrong, or you fixed it, 'cause I read it as 25 seconds, hence my question! :)


This is all moot, because you can just alias either command to a single letter if you use it that much.


I will switch immediately! ;-)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: