Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Installing Software Building Software From Source

Andrew Izquierdo
Andrew Izquierdo
3,212 Points

Difference between "which" and "find" ?

In the video when he wrote: "which make" to find where the "make" program lives in the system...

Why didn't he just type: "find / -name make 2> /dev/null" ... Wouldn't this ALSO show you where anything named "make" lives in the system?

...When should I use "which" instead of "find"?

1 Answer

Steven Parker
Steven Parker
229,644 Points

The "which" command looks only in the execution path defined in the environment, so it will generally respond immediately.. Use it to find something you can already execute by naming it on the command line.

The "find" command you show will search the entire file system, which may take quite a while to complete, but it will locate things that "which" might not. Use it when you need to find everything of a certain name in the file system.