My Linux Home Away of Home
Just a site of stuff that I know or claim to. ;-)

Finding Files in Linux June 5, 2017

Hi Guys,


I saw an interesting beginners video on Hak5 about locating files within linux. This made me think about some of the commands that I used to locate certain thing such as files used in apache compromises or files tha developers may have put on a server and forgot where. There are many ways to find what you are looking for but we need to start at the beginning. The following are from a video that Shannon Morse did on finding files.


I know the following seem to be the easiest and basic but we have to start somewhere in order to find what we are looking for. Thanks Shannon Morse for the following.



Locate 3 non case sensative words named test

locate -i -n 3 test


Locate case sensative words

locate test
locate Test

Search a file called Test for keywords such as word

grep word Test

Search for the keyword word in all files using *

grep word *

Locate a file that is case sensative and name specific in the current folder. If the files test or Test do not exist, nothing will be shown.

find -name test
find -name Test

Locate any file with the name test within it in the current folder.

find -name “*test*”

Locate files owned by a user (kf4bzt) in the current folder.

find -user kf4bzt

Locate files not owned by a particular user in the current folder.

find ! -user kf4bzt

Locate files with a specific group in the current folder.

find -group apache

Locate files not with a specific group in the current folder

find ! -group apache




Not that we have some basics behind us, we need to expand on them and do some other searching. 🙂


In order to find specific folders by name and place the results into a file:

find . -type d -name ‘uploads’ > uploads




Read the same file above as a reference for another find to locate php extensions within the folders found. 

for i in `cat uploads`; do find $i -type f -name ‘*.php’; done 



Let’s say that you want to locate files name page68.php and add the results to a file called comp. Below shows how to do this.

find . -type f -name ‘*’ -exec grep –i page68.php {} > comp \; 



Leave a Reply

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