Quantcast
Channel: List the files accessed by a program - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 8

List the files accessed by a program

$
0
0

time is a brilliant command if you want to figure out how much CPU time a given command takes.

I am looking for something similar that can list the files being accessed by a program and its children. Either in real time or as a report afterwards.

Currently I use:

#!/bin/bashstrace -ff -e trace=file "$@" 2>&1 | perl -ne 's/^[^"]+"(([^\\"]|\\[\\"nt])*)".*/$1/ && print'

but its fails if the command to run involves sudo. It is not very intelligent (it would be nice if it could only list files existing or that had permission problems or group them into files that are read and files that are written). Also strace is slow, so it would be good with a faster choice.


Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images