Andrew Maddison

Flowerchild.

Bash Alias to a Function for Find Command

So my bash-fu is weak, and my memory for which arcane switches to pass to command line incantations is even weaker, so I created the following in my bash_profile to alias the most common uses of find (for me). Which is just search, from the current path, for this file name.

1
2
3
4
5
alias find_from_here='ffh'

find_from_here() {
  find ./ -iname $1 -print
}

The Alias is optional really, as a function in bash_profile can be invoked from the command line directly, but it let me have a descriptive name in the source and a very short name on the command line.

I also created another one that’s case insensitive and with a wildcard appended (in case I can’t event be bothered to type “*”)

1
2
3
4
5
alias find_from_here_wild='ffs'

find_from_here_wild() {
  find ./ -iname $1* -print
}

Comments