Using Silver Searcher, how can I search for:
- (non-binary) files with a word or pattern AND
- all filenames, with a word or pattern including filenames of binary files.
Other preferences: would like to have case insensitive search and search through dotfiles.
Tried to alias using this without much luck:
alias search="ag -g $1 --smart-case --hidden && ag --smart-case --hidden $1"
Try this:
The command
find .
will list all files.We pipe the output of that to the command
ag "/.*SEARCHTERM[^/]*$"
, which matches SEARCHTERM if it's in the filename, and not just the full path.