0

I have created the following alias in my .bashrc file:

alias find='find . -type f -name'

This obviates the need to type . -type f -name every time I do a file search. However, I still have to enclose search strings with '*...*'. How could I include these in the alias, so that instead of having to type:

find '*string*'

I could just type,

find string
1

1 Answer 1

2

It is not easy with an alias but you can just define a shell function instead.

find() { /usr/bin/find . -type f -name "*$1*"; }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .