How to see what’s going in background when we run a .sh file in Linux? [closed]

I know one way i.e. ./ > log.txt. But that log file is containing the content what appears in console if we run the file using ./

Background process is not appearing in log file. By “background process” I mean how compiler is evaluating each and every line (the word “debug” suits that, I guess).

How to get that background process into a log file?


Based on your comment:

I mean I would like to know ‘How bash is executing each and every line of shell script’ when running a .sh file..

If you are using bash, then what you’re looking for is:

bash -x ./


bash -x ./ > log.txt

Alternatively you can add:

set -x

to the content of

Leave a Reply

Your email address will not be published. Required fields are marked *