Monday, March 10, 2008

Useful FIND NEWER command

An often overlooked but very useful function of the find command is the use of the -newer parameter, comes in handy for nailing down the time granularity of updated files.

Having coded fixes on the AIX 4.1.0 standard library, I have a bias and an affinity for the command, this article COULD go into depth about the powers of the find, but I'll keep this short.

The -newer parameter takes a filename as an argument to compare last modified time.

My typical M.O. is to touch a file /tmp/.newer then run find in the usual suspects' path
touch /tmp/.newerfind /var/ /usr -newer /tmp/.newerLet's say my Tivoli Enterprise Portal Server fails to start, I want to know which logs and files were updated during the startup attempt.
After a failed startup, I would

touch the file /tmp/.newer# touch /tmp/.newer
re-run the startup# itmcmd agent start cq
then run the find# find /opt/IBM/ITM -type f -newer /tmp/.newer<
(might want to throw in the -type f to limit the search to files only.)

If on Windows OS, then get Cygwin, the base installation is quick and comes with bash as default.

No comments: