Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
218,829 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.