Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Right, I understand the problem. Find and xargs can do wonders. However, that's usually an edge case (in my professional experience). I'm certainly not proclaiming the advanced-ness of 'ls' in this circumstance.

However, in the example in the article, he was using "ls" piped to "grep" in order to find all files with a 5 in the name. That would suffer from the same consequences you mentioned, on such systems, and is inefficient and verbose.

Note, I agree with your advice to teach "find" (and "xargs") to users.



True,

  ls | grep 5
is reliable where

  ls *5*
is not. (Well, except for awful names that require "find -print0", or preferably having the file taken out and shot along with its creator.)

I'm actually not a fan of xargs. It's more unixy, but somehow I find its options hard to remember. Off the top of my head I find it easier to do

  find -exec blah {} +




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

Search: