Save Python Print Message into File When Training Model on Linux – Deep Learning Tutorial

By | June 13, 2019

When we train our deep learning model in linux ternimal, we may see many python print messages.

linux terminal output

These messages include loss value, train steps, time or accuracy etc. These message are very helpful for us to evaluate our model.

However, Messages in linux ternimal are not saved into a file, if you close terminal, you will never see them.

How to save python print message into a file?

Here we can use script -f log.txt command.

Then all messages in terminal will be save into log.txt file

Of course, if you want to stop save messages into log.txt, you have to ways.

1. Open a new terminal

2. Press Ctrl+D to close script command

Here is my effect using script.

save linux terminal output to file

Leave a Reply

Your email address will not be published. Required fields are marked *