Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On linux, the default find command ((GNU findutils) 4.4.2 on my system) has an optional path parameter, which defaults to current directory (the common case). From man page:

find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]

On OSX, find does not have an optional path parameter:

usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
       find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]

I find this quite annoying. Has anyone solved this issue with a clever command alias/shell function, or perhaps by installing a different version of find?

share|improve this question

migrated from stackoverflow.com Jan 16 '13 at 20:16

This question came from our site for professional and enthusiast programmers.

2  
This is completely OT for SO, but historically find always required a path - it became optional in Linux but that is by no means standard. Typically you just type . for the path when searching from the current directory, e.g. find . -name foo.txt. –  Paul R Jan 16 '13 at 16:19
    
@PaulR sorry, I wasn't sure if this would be OT or not. I found some other questions asking about command line usage. Maybe they were old, before other stack exchange domains went up. Where would this belong? –  michalmocny Jan 16 '13 at 17:49

1 Answer 1

up vote 1 down vote accepted

OS X uses BSD find, which has historically required a path. You can install GNU findutils via MacPorts or the like.

share|improve this answer
    
Or create a simple shell script... –  weberc2 Jan 16 '13 at 21:13
    
Why a shell script when a function will do? –  Ignacio Vazquez-Abrams Jan 16 '13 at 21:31
1  
brew install findutils installed gfind which I could alias. Thanks! –  michalmocny Jan 16 '13 at 22:22
    
@IgnacioVazquez-Abrams because it doesn't necessitate installing MacPorts or something similar. –  weberc2 Jan 17 '13 at 14:29
    
You don't need to install anything to have functions; they're part of bash. –  Ignacio Vazquez-Abrams Jan 17 '13 at 16:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.