1

When I type find into my terminal, this is the output I get:

My-MacBook-Air:desktop User$ find
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
       find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]

How does my computer know where the source code for this command is and how can I access it myself?

1 Answer 1

5

Ok well ... first this is probably not Linux but MacOS? But no matter what, your computer doesn't use any source code but a compiled executable, that is located somewhere in your search path -- a list of directories that are searched when you enter a command, typically something like /usr/local/bin:/usr/bin:/bin

You can display your search path with echo $PATH and find the full location of find with which find.

No idea what version of find comes with MacOS ... if you're really interested in source code, you could download the version typically installed on linux systems here: http://ftp.gnu.org/pub/gnu/findutils/

Sign up to request clarification or add additional context in comments.

2 Comments

So the way my computer calls the find command is through an executable binary script?
It's not a script ("binary script" somehow contradicts itself). It is native executable code in an executable file. This is actually true for most programs you run nowadays. Notable exceptions are Java or .NET programs (which run in a virtual machine, but are still binary) and, well, scripts (which are readable source in text form, interpreted at run time).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.