Linux的重复命令自动 [英] Linux repeat command automatically
问题描述
是Linux命令行有可能有一个命令重复每隔n秒。
Is it possible in linux command line to have a command repeat every n seconds.
举例来说,假设我有一个导入运行和我做
For example, say I have an import running and i am doing
ls -l
检查文件大小在不断增加。我想有一个命令有这个自动重复。
to check the file size is increasing. I would like to have a command to have this automatically repeat.
推荐答案
观看每5秒...
看-n 5的ls -l </ code>
watch -n 5 ls -l
如果你希望有变化的视觉确认,追加 - 差异
之前的 LS
命令
If you wish to have visual confirmation of changes, append --differences
prior to the ls
command.
据OSX的手册页,这里还有
According to the OSX man page, there's also
该--cumulative选项使突出粘,presenting一个
运行曾经更改的所有位置的显示。该-t
或--no标题选项关闭显示的时间间隔的头,
命令,并在显示器的顶部当前时间,以及所述
下面的空行。
The --cumulative option makes highlighting "sticky", presenting a running display of all positions that have ever changed. The -t or --no-title option turns off the header showing the interval, command, and current time at the top of the display, as well as the following blank line.
的Linux / Unix手册页,可以发现这里
Linux/Unix man page can be found here
这篇关于Linux的重复命令自动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!