bash debug – log all executed commands
2014-02-03
156 words
1 min read

Whenever I am writing a script in perl or bash, I always wish that there
was some way to have all the commands logged or output to screen. I know
there is “set -x” option to have debugging enabled, but sometimes that
seems to be too much information and I dont really need all that. So, here
is something I found recently for bash to log all the executed commands.
trap "echo $BASH_COMMAND" DEBUG
This will echo/print all the commands on the stdout.
Related articles
Related Articles:
- 2012/03/02 15 Linux Bash History Expansion Examples You Should Know
- 2010/12/23 Bash Script Beautifier
- 2012/03/08 bash prompts — some good links
- 2011/08/03 Installing Full Blin g theme on N900
- 2011/01/31 Ranking of the most frequently used commands

Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.