Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a remote machine,the disk space on the HP-UNIX machine was 96% so I was going to reduce the disk space by zipping some "*.extract.sys" files.

$find . "*extract.sys" -exec ls -lrt {} \;

Now the above commad is supposed to show the files with extension "extract.sys" but instead I am getting files with extension extract, some directories, and files with other extension.

why is this happening? I hope that its not because of the disk space.

EDIT: Is there another way around or I am doing some mistake/missing something

share|improve this question
find is recursive, so for starters, remove the recursive (r) option from ls. – Mike Fitzpatrick Jul 4 '11 at 4:11
I worked for me before but today its not working anyway I tried removing the recursive(r) option but still the same results – munish Jul 4 '11 at 4:14
up vote 2 down vote accepted

You want to use the -name option before *extract.sys; otherwise it will look in directories matching *extract.sys (in addition to .) rather that looking for files matching *extract.sys. Also you should use single quotes around *extract.sys instead of double quotes so that the shell will not treat it as a wildcard. (You only want find to treat it as a wildcard, not the shell.)

find . -name '*extract.sys' -exec ...
share|improve this answer
Thanks,Ahh I was missing it .... – munish Jul 4 '11 at 4:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .