leon
leon

Reputation: 492

How do I make the "tree" command slower?

It started out as "how do I impress my friends when they look at my screen" and now I'm actually very intrigued by this question:

Is there a way to make the tree command in Ubuntu "slower"?

I don't mean maxing out CPU usage and then having it execute slower, I mean is there a way to set a limit on lines being written to the terminal per millisecond? So that instead of tree printing everything at once, it prints one line every (for example) 100 milliseconds.

I haven't found anything related to that searching the web.

Upvotes: 0

Views: 1035

Answers (1)

choroba
choroba

Reputation: 241908

You can read the output of tree line by line and sleep a bit after outputting each:

tree | while read -r line ; do
    printf '%s\n' "$line"
    sleep 0.1
done

Upvotes: 2

Related Questions