niki+a
July 4th, 2011, 03:08 AM
Hi,
every time I open up a terminal to do some cml magic, I'd like the entire session to automatically be logged. (Including what is set by PS1 variable before the $, I already added a timestamp + date to PS1 so I can know when I did what.)
I was trying to do something like so inside .bashrc file:
#log everything i do in terminal
script -afq ~/log/shell.log.txt
But it does not work, I get really strange output and the standard .bashrc run does not exit properly. I have to ctrl + c and that obviously kills the .bashrc invocation because I do not get my ps1 colors/date formatted.
It's hard to Google this strategy also, because every time I type in .bashrc + logger + script in Google I get newbie tutorials about "running scripts and what is purpose of bashrc".
Next step would be to write a bash script to archive every terminal run in individual files with a time stamp. But I'm sure that will be a breeze once I get this figured out.
One more thing, if I run script inside terminal, output is formatted very strangely. I get weird line feed characters like so:
^C^[]0;
Any advice on how I can format the output I get from script command? And if you have advice or a resource on how I can Google script command examples or tutorials I would appreciate it, because when I Google script + format output, I don't get the most pertinent results.
every time I open up a terminal to do some cml magic, I'd like the entire session to automatically be logged. (Including what is set by PS1 variable before the $, I already added a timestamp + date to PS1 so I can know when I did what.)
I was trying to do something like so inside .bashrc file:
#log everything i do in terminal
script -afq ~/log/shell.log.txt
But it does not work, I get really strange output and the standard .bashrc run does not exit properly. I have to ctrl + c and that obviously kills the .bashrc invocation because I do not get my ps1 colors/date formatted.
It's hard to Google this strategy also, because every time I type in .bashrc + logger + script in Google I get newbie tutorials about "running scripts and what is purpose of bashrc".
Next step would be to write a bash script to archive every terminal run in individual files with a time stamp. But I'm sure that will be a breeze once I get this figured out.
One more thing, if I run script inside terminal, output is formatted very strangely. I get weird line feed characters like so:
^C^[]0;
Any advice on how I can format the output I get from script command? And if you have advice or a resource on how I can Google script command examples or tutorials I would appreciate it, because when I Google script + format output, I don't get the most pertinent results.