Terminal User Guide
To locate a string within a file, use the grep
tool.
The grep
tool searches the named input files for lines containing a match to the given pattern. By default, grep
prints the matching lines.
To search for a unique string in a file:
There are a lot of flavors of answer to this out there, none of which seem to work for me. Let me say right off the bat that my terminal (I'm running Yosemite) recognizes neither '-cmd' nor '-run' nor '-r'. So, here is the breakdown: 1. I am able to launch AE from the terminal. I am able to ope. To do this, select the following criteria for your search: System files include. However, even this will not search all files on your Mac (i.e. Items in hidden folders). To search all locations for a file, perform the following: Open Macintosh HD Applications Utilities Terminal. In the window that opens, type the following, then press Enter. Show All Hidden files and folders on the Mac. Open Terminal on your Mac, which you can find in LaunchPad Others Terminal. You can also search for it through Spotlight. Once Terminal is loaded copy and paste the following command in it, and then hit the ‘Return‘ key. Defaults write com.apple.finder AppleShowAllFiles YES. In such a case, the “line” it returns is the entire file; this can dump a lot of text into your Terminal window. In the previous example, grep ran in a specific folder, checking all the files.
Replace search_string with the string to search for, and replace filename with the name of the file whose contents you want to search.
Like Windows, macOS also has secret files that are hidden so that a user doesn’t meddle with it but sometimes you need to access the hidden files.
If you want to tweak a setting to perform a troubleshooting step (like finding a log or deleting a preference file), you need to make some changes in those hidden files. Some of you also want to get rid of the files from the hidden folder as they take way too much space.
So the question is “how to access the hidden files?”

Well, we have a solution for it. With the help of terminal and simple command, you can get your Mac’s hidden files and folders.
Must Read:How To Rename Multiple Files At Once On Mac
In this article, we have discussed how to view hidden files and folders on Mac with Terminal.
Launch Terminal
- You can launch Terminal via Spotlight.
- Go to Finder bar and look for a magnifying glass like icon and click on it to open Spotlight.
- Type Terminal, Spotlight will open a terminal for you.
- You can also locate Terminal:
- On OS X, open your Applications folder.
- Go to Utilities folder.
- Open the Terminal application.
Search For File Mac Terminal Download
Must Read: Quitting Apps on Mac Just Got Handier!
View Hidden Files and Folders:
Mac Terminal Search For File
- Now that you have accessed Terminal.
- Type or copy/paste the following commands into the Terminal window:
“defaults write com.apple.finder AppleShowAllFiles TRUE” (This command tells the Finder to show all files, irrespective of the hidden flag setting )

“killall Finder” (This command will stop and restart Finder, so that the changes can take place)
- Press the return or enter key after you enter each line of text.
- These commands will allow you to use Finder to find all the hidden files on your Mac.
Note: It is normal to see the Desktop screen vanish and reappear while executing the commands.
Once these commands are executed, you will be able to see a file named.DS_Store. The .DS_Store file consists of information about the folder, you are currently in, including the icon, the location of the window and other bits of information the system requires. Moreover, you get the access to the important hidden folders such as the Library folder inside your Home folder. The Library folder contains many files and folders which is related to a particular apps and services that you use on your Mac.
Note: It is recommended to take a good look at your Library folder and target the issue that you are having, then make any changes.

Hide The Files:
Now that you have seen the hidden folders or you are done with the troubleshooting, you must hide the folders to keep them safe.
- Open Terminal (Follow the steps to launch Terminal)
- Type the below commands into the Terminal window:
“defaults write com.apple.finder AppleShowAllFiles FALSE?”
“killall Finder”
Press return key or enter key to execute the command and done, the hidden files are hidden once again.
In this way, you can hide and show the hidden folders of Mac with the help of Terminal. Try it and let us know what worked for you.
Mac Find Command
Next Read: How To Use Mac’s General Preferences Pane
Search Files Mac Os Terminal
Watch this space for cool tech tips!
Responses