Sample Header Ad - 728x90

List the files accessed by a program

88 votes
8 answers
91087 views
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/bash strace -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.
Asked by Ole Tange (37348 rep)
Aug 16, 2011, 02:51 PM
Last activity: Aug 5, 2025, 10:58 PM