Find files that were modified by a given command

touch /tmp/file ; $EXECUTECOMMAND ; find /path -newer /tmp/file
This has helped me numerous times trying to find either log files or tmp files that get created after execution of a command. And really eye opening as to how active a given process really is. Play around with -anewer, -cnewer & -newerXY
Sample Output
[root@localhost ~]# touch /tmp/service
[root@localhost ~]# service cups restart
Stopping cups:                                             [  OK  ]
Starting cups:                                             [  OK  ]
[root@localhost ~]# find /var -newer /tmp/service
[root@localhost ~]#

2009-08-31 18:47:19

1 Alternatives + Submit Alt

What Others Think

Great command! Another way could also use strace. strace records all system calls made, and you can even attach it to running processes: strace -o straceoutput.txt $COMMAND also use -p $PID to attach to an already-running program. Also, use ltrace to trace library calls.
bwoodacre · 675 weeks and 5 days ago
Prefer to use lsof -p, see command: diff
zlemini · 645 weeks and 3 days ago
diff <(lsof -p 1234) <(sleep 10; lsof -p 1234)
zlemini · 645 weeks and 3 days ago
It's informational and imaginative, which makes it easier for us to find files that were modified by a given command. It is worth it, some things that are needed on the internet, some bit originality. Helpful purpose of bringing new things. cbd oil for heart disease
TwanGrey · 2 weeks and 6 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: