-3

I have tried to use FIND command but i couldn't figure out exactly how it works. Can someone help be. I want to know how i could use this command to find where the boot.log file is stored?

0

1 Answer 1

2

The simple way to use find is:

find DIRECTORY EXPRESSION
find /var/log -name boot.log

To give you an idea of the vast possibilities of find please refer to the man-page

man find

and scroll through to the EXAMPLES section.

If you have many files on your system and if you start find at the / root directory, find can take some time. Therefore my advice is, to limit your search to distinct directories like /var. Another drawback is, that find runs with your user priviliges; running find /home -name something will mostly print only your files (unless you are root user ;-)

Another way to find certain file is to make use of the locate database (if enabled). locate boot.log.

locate utilizes a local database created by updatedb; it has a couple of advantages and also a couple of drawbacks.

Firstly, updatedb is not installed and enabled by default (for security reasons, because updatedb keeps track of most files on a system, even those with only user permissions). Secondly normally updatedb is run periodically once a day, so you can not find today's files.

But on the bright side, once enabled locate is very fast and performs only lookups in the locate database and and goes easy on i/o system ressources.

1
  • If one has no idea where boot.log is, then the find command you showed is too specific. Better would be 'find / -name boot.log 2>/dev/null' which would search from the root directory and dump all the error messages telling you that permission was denied or just 'su find / -name boot.log'
    – jpezz
    Jan 21, 2018 at 23:19

Not the answer you're looking for? Browse other questions tagged .