-
updatedbneeds to be run because I had made changes to the config files under/etc/logrotate.dwhich have configs forapache2,apt,ufw, etc. The configs affect the files under/var/logwhich has files with substring access.log underapache2/access.log. Now runninglocate access.logwill list all such files which have access.log as a substring. -
I cannot seem to fing how
updatedbcommand runs (by cron or systemd?). There doesn't seem to be a reasonable entry in/etc/cron.weeklyor/etc/cron.dailyand the files under/run/systemdare complex for me to understand at the moment. -
There are 3 kind of "timestamps" (output of
stat<filename>) -Access - the last time the file was read
Modify - the last time the file was modified (content has been modified)
Change - the last time meta data of the file was changed (e.g. permissions)
-
finduses the permissions of the logged-in user you’ll get “permission denied” messages for many directories if you search the whole system. -
The output (stdout) produced by
findand the "Permission denied" error (stderr) produced by it go on two different streams. Thus, whatgrepfilters is the output (stdout) only and not the errors (stderr). They (errors) show up as they are. Therefore, we need to do this,
find /home -mtime 0 2>&1 | grep -vi "Permission denied"This takes in stderr stream to the stdout then grep can remove the unwanted things.
This syntax should be used with find to filter through errors and outputs.
- On the above lines, we can use
grepin the same way, but this now searches for a substring delaycompress in the content of a text file by reading recursively all files under/etc/.
grep -R -i "delaycompress" /etc/* 2>&1 | grep -vi "Permission denied"-
Because
grep -Ronly works on plain text files, it's most useful for the/etcand/var/logfolders. -
Know to use
-execoption offindcommand.
My pull request (on the above discussion of filtering out errors from find with grep) was merged. I am so happy. 🤩
