In linux you can use the “find” or “locate” command to look for a specific file or folder. The best alternative I know on Mac is Spotlight. However Spotligh is based on a graphical interface and the “best” option is to show all the results on the Finder, which is not very handy if you work all the time on the command line. After some research, I found a way to use Spotlight from the command line and show the results as the find or locate command on linux.
The main command to show Spotlight results on the terminal is :
where $NAME is the word you are looking for.
To make it easier to use and remember, I put an alias on my bash
1 – Open the file ~/.bash_profile
2 – Add the following lines
{
mdfind -name $1
}
alias find=search
3 – Reload you bash
you can now use the “find $NAME” command within your terminal as you would use it on linux and enjoy the results 😉
Related links :
– Bash alias and parameters
– Search Spotlight from the osx terminal
Source: New feed