There several ways to find files in OS X, the most popular of which are GUI-based routines such as the Spotlight menu and the Finder search, both of which offer quick access to the system's metadata search index. However, there are other options for accessing this index and otherwise finding files you might be interested in locating.
Of course besides Apple's GUI options there are some third-party searching tools available; however, without these the other option in OS X is to use the Terminal, which can benefit both Terminal and GUI-based routines.
The first option in the Terminal is the classic 'find' command that is common to many Unix systems, which will recursively walk a specified folder hierarchy and search items for a given name pattern. The find command has a number of options you can use to narrow down search results, and these can be looked up on its manual page, but the basics for finding a file are to specify the starting path and the name, such as the example here to locate a file called 'test.txt' starting in the Users directory:
find /Users -name 'test.txt'
Since the find command walks through the filesystem hierarchy, it may take a long time to complete, and if you specify the root folder only (without using flags to prevent recursion), it may recurse through the /Volumes/Macintosh HD/ mount point directory repeatedly and never end the search.
Beyond the find command are two that offer indexed search results. The first of these is the 'locate' command, which will build a database of system resources and then allow you to find them by simply typing the following command:
Now, lets see how can a user set up ADB on his various OS incl. Windows, Linux & Mac. Since ADB is bundled with Android SDK, so you need it prior for your respective OS. Below are few easy steps to setup ADB easily on your OS without much hassle. If the.msg file is located on the Mac or in a location shared by the Mac (host) and Windows 7 (Fusion instance) and I open it by double-clicking it (on the Mac side), it opens using the 3rd party conversion program OutlookMsgViewer and then in Outlook for Mac perfectly.
locate NAME
In this command, NAME can be any partial file name and the command will output the full path to any item that includes this name. The locate command does require a properly built 'locate' database, which Apple blocks by default in OS X; however, you can enable the launch daemon that regularly builds and updates the locate database with the following command:
After this command is run, after a while the locate database will be assembled and be ready to use, but once it's completed you can use the locate command to search for numerous system files that you might know of by name. Do keep in mind that this command will only search for system files and will not index the user directories for finding personal files.
The final command is the 'mdfind' command, which will locate files on your system that have been indexed for use with Spotlight. This command is arguably the more thorough of the two prior commands, as it will search both user and system files by default, and also offer options to search by file name and by file content, just like Spotlight searches.
To use this command, simply run it as follows; it will output a list of full paths to the files that include the search term: Best free file manager app for mac.
mdfind NAME
Best Android App For File Transfer
As with all of these commands, the mdfind command has a number of additional options that can be implemented for limiting and customizing its search scope, which can be looked up in the mdfind manual page.
With these commands, you can easily output the full path to files you may be interested in locating, and then be able to access them either in the Finder or use the full path in subsequent Terminal commands. To reveal items in the finder, simply triple-click one of the paths to select it, and then right-click the selection and choose 'Reveal in Finder' from the Services contextual submenu.
Questions? Comments? Have a fix? Post them below or e-mail us! Be sure to check us out on Twitter and the CNET Mac forums.
Active8 years, 4 months ago
When I clicked on terminal.
It shows this:
not a valid identifier Josh@Macbook-Pro~$ export
I installed something yesterday and modified bash_profile. Now I cannot do anything in terminal. Even ls. It returns -Need help. How can I fix it?
This question came from our site for professional and enthusiast programmers.
4 Answers
By the look of that string, it looks like you have messed up your $PATH. Look for the line with the string matching the error it output, and try changing it to:
To do this in bash you will probably have to specify the full path for an executable to edit it with, or you could do it with a GUI application. Otherwise, if you have any other shells on your system, try using those and seeing if their $PATH is functioning, and if so you can edit the file as normal through that shell until you get back into bash.
It goes without saying, you should always back up before modifying important files like bash_profile.
Matthieu CartierMatthieu Cartier
I'm going to assume you know what you modified and you just need a working shell. The easiest way to do that is just boot into single-user mode to make your repairs. To do that, reboot and hold down Command-S until you get to the shell prompt.
jbrunijbruni
Enable Find to view all hidden files. Since you can't issue any commands from Terminal.app, I think you can either use Onyx (there's an option in Onyx to show hidden files in the Parameters tab), or download a text editor that sees hidden files (eclipse-based IDEs usually see and can open hidden files, or something like TextWrangler or TextMate can do that same). Free zip app for mac.
Navigate to your bash profile through the file system or through the 'open file' dialog of one of those editors and make your changes..
revdrjrrrevdrjrr
You could try to temporarily use another shell than bash (like zsh).
Go in the Terminal Preferences and click on the Startup tab.
change the 'Shells open with' setting to /bin/zsh
Windows 10 Change Default App For File Type
Open a new terminal window and there you have a working shell which you can use to edit your bash_profile.