Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the script command that can be used to capture a series of commands that you run along with any output that they generate. This be helpful when you are documenting a process or testing a series of commands.
To start recording, type “script” followed by the name of the file you want to generate. If you don’t specify a filename, the file will be called “typescript”.
Now, let’s run some commands:
Once you’ve run the commands that you want to capture along with their output, enter ^D (hold the Ctrl key and press “d”) to stop collecting commands and their output.
As you can see from the file listing below, test1 is now the newest file and has captured some data:
Look at the file and you should see the commands and output along with timestamps that show when you started and ended collecting the data:
That’s your Linux tip for the script command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.