I want to know what files were created during execution of some shell command.

  • You can strace them. man strace. strace -s 200 -f my_script.sh 2>&1grep -E '(open|creat)' – peterh - Reinstate Monica Oct 14 '15 at 22:39
  • @peterh, that is at least something... this can give me a list of files that was USED by script... i'm still looking how i can determine only CREATED files... – Brazhnyk Yuriy Oct 14 '15 at 22:48
  • 1
    Not true, the grep command filters out the file creation calls for you. – peterh - Reinstate Monica Oct 14 '15 at 22:55
  • 1
    1: The crap is not so crappy, but yes, also not trivial. There aren't noo many system calls, it is relatively easy to learn them. 2: much simpler way doesn't exist, because your question indirectly means that you want to follow all commands called by your script, thus you need to trace this on the system call level. – peterh - Reinstate Monica Oct 15 '15 at 0:26
  • 2
    You can add some useful options to strace: strace -e open,creat -f -o /tmp/out myscript... to just trace open and creat, to trace children, and to output to a separate file. – meuh Oct 15 '15 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.