The “find” command, which searches directories for files, is great but requires a lot of options to perform a simple search. Usually I want to search the current directory for a specific file name, but doing that requires all this typing:
find ./ -iname "*my_search_term*"
What I would like to be able to is just type:
f my search term
and have it match files that look like that. Here’s a little bash script I call “find.sh” that does it:
args=`echo "$*" | sed -e "s/ /*/g"`
eval find ./ -iname \"*$args*\"
then just put the following in your ~/.bashrc
This script takes the arguments, converts spaces to wildcards, then does a case-insensitive search of the current directory. So “f foo bar” gets translated to
find ./ -iname "*foo*bar*"