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.





Leave a Reply

Your email address will not be published. Required fields are marked *