Skip to content
Advertisement

how to search a file only in user profile and root in linux/unix [closed]

Currently i am using the below find command to find the cert8.db file

find / -type f -path ‘.mozilla/*’ -name “cert8.db”

The above command is trying to search the file everywhere.

I would like to scan the file only under root and user profiles(Unknown, unknown1 etc).

most common location for this file is:

in root: /root/.mozilla/firefox/i636e2gs.default/cert8.db

profile unknown: /home/unknown/.mozilla/firefox/bz5xry7t.default-beta/cert9.db

profile unknown1: /home/unknown1/.mozilla/firefox/bz5xry7t.default-beta/cert9.db

Note: I am not sure, this could be the Mozilla’s default initialization location.

Thanks,

Advertisement

Answer

find expects zero, one, or more paths where to look for files and apply its expressions. Replace (/ = file system root) with all locations you want to be searched:

find /root /home -type f -path '.mozilla/*' -name 'cert8.db'

You might even limit the search space further by moving the .mozilla part into the list of starting points if it is a reasonable assumption that the .mozilla directory is always a direct child of the root folder or the home directories (making your shell do the work instead of find):

find /root/.mozilla/firefox /home/*/.mozilla/firefox -type f -name 'cert8.db'
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement