Monday, June 25, 2012

How to record terminal activities and outputs to a log file


In today's tip, I will show you how to record everything you run in the terminal and the outputs into a text file. This can very handy for you, especially when you are an administrator of a linux dedicated server, to analyze problems or seek help on forums or irc channels if you messed around with the commands and it resulted to troubles.

The command to record activities in the terminal is "script", before executing any other thing, you just need to run the following command to make a log file:

 script log.txt  

After that, everything you run afterward in the terminal and the outputs will be recorded into this log file.

If you dont want to record the activities anymore, you just need to hit Ctrl +D. To start recording again to the same log file, you can run this command:


 script -a log.txt  

No comments:

Post a Comment