简体   繁体   English

如何使“树”命令变慢?

[英]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"?有没有办法让 Ubuntu 中的tree命令“变慢”?

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?我并不是说最大化 CPU 使用率然后让它执行得更慢,我的意思是有没有办法设置每毫秒写入终端的行数限制? So that instead of tree printing everything at once, it prints one line every (for example) 100 milliseconds.因此,它不是tree打印所有内容,而是每(例如)100 毫秒打印一行。

I haven't found anything related to that searching the web.我还没有找到与搜索网络相关的任何内容。

You can read the output of tree line by line and sleep a bit after outputting each:您可以逐行读取tree的输出,并在输出后稍作睡眠:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM