How to slow down output of a shell command using Python

On Linux there are a many times that a command or just a text file has a lot of output which is of-course impossible to read.

How to slow down output of a shell command using Python
Photo by LOGAN WEAVER on Unsplash

On Linux a command or a text file can produce a lot of output which is really difficult to read with tail or cat because speed, there are ways to make things easier with less command, but what about output that is constantly produced? like a program or a log file?

I created a small python tool that prints piped input with a delay of one line per 100ms by default.

Example how to setup the tool:$ chmod +x slowout.py
$ sudo mv slowout.py /usr/bin/slowout

Example: run with defaults$ ls -lta | slowout

This will print one line per 100ms, enough time to see text scrolling and catch details.

Example: How to define delay$ ls -lta | slowout .5

This will print one line per 500ms.