How do I search for something in Terminal?

Searching in Terminal: I want to find instances within a particular directory branch of anything which includes the word "zend" and be provided with the paths to those instances. Is this possible in Terminal?

G4 400, Mac OS X (10.4.2)

Posted on May 29, 2006 9:13 AM

Reply
10 replies

May 29, 2006 10:35 AM in response to davidbjames

There are a bunch of ways to list and find things in terminal.

It sounds to me as though you are a realitive beginner to the Unix command line (as I was several months ago) so perhaps instead of giving you the answer to your question precisly it would be more helpful for me to show you how to figure this sort of thing out for yourself User uploaded file

The first thing you are going to need to familiarize yourselfe with is the "man" command.

man will get you the "manual page" for most any command that you are looking to use. You can also look them up online, but man is a good first hit, and generally will have all the info you need.

The command that you are going to be needing for this opperation are

ls
grep


Basically, you are going to want to list recursivly with the ls command, and than pipe the out put of that into grep to search for the charactor pattern "zend" that you are looking for.

Check it out. See how faryou get, and feel free to ask more questions. Learning this stuff is an investment that really does pay off.

B

May 29, 2006 7:13 PM in response to davidbjames

Thank you everybody for your replies and YES I am interested in learning, though I must say the number of commands, options and parameters can be a tad overwhelming..

Still, for now, I have focussed on the "find" command as that, in fact, is what I was looking for: a file search NOT a content search.

I've experimented with the -name and -iname as well as the search expression.

Will try different options and the ls and grep commands tomorrow.

G4 400 Mac OS X (10.4.2)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I search for something in Terminal?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.