bob dylan
bob dylan

Reputation: 1109

Capture executed commands from programs

Is there a way to capture the commands executed by GUI programs ? Or even simple bash scripts ? Like the "history" command from bash but available on the whole system.

Upvotes: 1

Views: 547

Answers (1)

user3159253
user3159253

Reputation: 17455

A shell (e.g. bash) has -x option and you can see all the commands which are executed by a particular script. run sh -x <your_script and see the output. You also can temporarily turn on/off this logging by issuing set +x, set -x inside a script.

regarding GUI programs, the answer depends on your needs, what kind of activity you'd like to log. You can use strace as suggested in the comments, and filter out exec* calls. But likely you assume something else since most activities of a GUI program are performed w/o executing external programs.

Upvotes: 1

Related Questions