I would like to redirect the command executed along with the output to a file.
for example: #ls >ls_out.txt
ls_out.txt should be something like :
You could use "script" command: Something like this:
You will just have to get rid off "bash-3.2$ exit exit" piece.
I use a function for this kind of thing: