

See File Metadata Query Expression Syntax and for using other search operators. In some shells, you can redirect standard error, or stderr, to a file. To avoid opening bash scripts or other non-document files, you may restrict file contents by additional search attributes.
/ScreenShot2019-01-03at3.13.16PM-5c2ea61c46e0fb0001abc508.jpg)
Additional cd is for case insensitive and ignoring diacritical marks, e.g., fred will return both, Frédéric and FrEDeric.įindpaper will restrict search to results under a specific path (recursive) while openpaper pie*201 will open a (or first of multiple results) search result or openpaper pie*201 3 will open third result entry. For more info about the powerful find command, open a terminal and type man find.

I think the above covers most of the usual use case scenarios. This will display all files accessed during the past two days in the location of the search. There is no need to prepend or append * to your query as the search pattern, '*$1*' already tags wild card entry at beginning and end of your query. If you accessed the file two days ago, use this instead: find / -time -2. To search for files with words, pie and 2016 anywhere in the file name, do spot pie*2016 #or In Linux, everything is a file, including the host status and its port. Now, either source ~/.bash_aliases or open a new terminal load functions. To open the terminal simply press cmd+Space to open Spotlight search. Open "$(mdfind -name -onlyin "/Users/foo/articles" "kMDItemDisplayName='*$1*'cd" | sed -n "$")" By default, grep prints the matching lines. The grep tool searches the named input files for lines containing a match to the given pattern. # default to open the first entry unless 2nd positional argument is given To locate a string within a file, use the grep tool. Mdfind -onlyin "/Users/foo/articles" "kMDItemDisplayName='*$1*'cd" # restrict to files under (recursive) a specific path # find any item matching search query in file name I find this easier than typing long string of query in spotlight window.Īdd following functions in ~/.bash_aliases. You may use following command line functions to quickly find and open relevant file.
