Skip to content
Advertisement

How to take continuous back up of linux gnome terminal logs? commands and output of that command

I want to take continuous backup of logs being printed in my linux terminal. Is it possible that whenever something will be printed in my terminal, it will automatically get printed into some text file with time stamp.

Advertisement

Answer

Use the script command ie

script log.txt

at the start of your session. You can also add this to your bash profile so that it starts when you open a terminal etc. You need to use

script -a log.txt

to append. Don’t try and cat it or tail it while in the session, you need to CTRL-D then have a look at what got logged.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement