How To Look For A Program In Terminal Mac

Opening a console on Mac OS X¶. OS X’s standard console is a program called Terminal.Open Terminal by navigating to Applications, then Utilities, then double-click the Terminal program. You can also easily search for it in the system search tool in the top right. Now, you need to look for any 0 values in the subnet mask, turn them into 255, and put them into the same position in the IP address field, and then ping that network address. For example, my subnet address has the zero in the fourth position – so my “special” ping address will be 192.168.2.255.

Active2 years, 3 months ago

I'd like to find all files that contain a certain string of text. How would you do that in the Terminal?

Chealion
22.6k7 gold badges61 silver badges71 bronze badges
SvishSvish

How To Execute A Program In Terminal

17.9k55 gold badges112 silver badges170 bronze badges

5 Answers

Ignacio Vazquez-AbramsIgnacio Vazquez-Abrams
98.7k7 gold badges162 silver badges217 bronze badges

How To Look For A Program In Terminal Mac Commands

user46046user46046
  1. Through Ack

brew install ack ack 'text goes here'

  1. Through find
Program

find . |grep 'text goes here'

  1. Through grep

grep -RnslI 'text goes here'

Anant GuptaAnant Gupta

You can choose one of the below depending on your taste and needs. Supposing you need to search for files containing text - 'async', recursively in current directory, you can do so in one of the ways like below:

Using grep

Using ack

karthikskarthiks

Ignacio's Answer is great and helped me find the files containing certain text. The only issue I was facing was that when running this command all the files would be listed, including one where the pattern did not show up.

No such file or directory This is what I see alongside files that do not contain the pattern.

If instead you add -s to the command, as in:grep -lr 'text pattern' ./ -s ; grep -lr 'text pattern' [PATH DIRECTORY] -s is used, it will only show you which files contain the pattern.

Similarly if grep -nr 'text pattern' ./ -s ; grep -nr 'text pattern' [PATH OF DIRECTORY] -s command is used it prints the file plus the line number, and occurrence of the pattern.

Please correct me if my understanding is wrong.

CP3OCP3O

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