Tip: Easily Find Files In The Current Directory

If we insert the following function into our .bashrc or .zshrc we can then easily run what I call a “quick find” on the current working directory.

# qfind - used to quickly find files that contain a string in a directory
qfind () {
    find . -exec grep -l $1 {} \;
    return 0

Now, when working at the command line we can type qfind to run a “quick find”:

$ cd /var/log/apache2
$ qfind http



This indicates that the string “http” is present in the error_log file within the /var/log/apache2 directory.

Michael is the creator and main author of the Smalley Creative Blog. He is a guy who enjoys technology (particularly open source), educating people about technology, and working with people who enjoy technology as much as he does. Follow him on Twitter @michaeljsmalley.

Leave a reply:

Your email address will not be published.

Site Footer