在Linux中自动重复命令 [英] Repeat command automatically in Linux

查看:308
本文介绍了在Linux中自动重复命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux命令行中是否可以让命令每 n 秒重复一次?

Is it possible in Linux command line to have a command repeat every n seconds?

说,我正在运行导入,我正在做

Say, I have an import running, and I am doing

ls -l

检查文件大小是否正在增加.我想要一个命令来自动重复此操作.

to check if the file size is increasing. I would like to have a command to have this repeat automatically.

推荐答案

每5秒钟观看一次...

Watch every 5 seconds ...

watch -n 5 ls -l

如果希望直观地确认更改,请在ls命令之前附加--differences.

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选项使粘滞"突出显示,并显示 运行显示所有曾经改变过的位置. -t 或--no-title选项关闭显示间隔的标题, 命令,当前时间在屏幕顶部以及 在空白行之后.

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中自动重复命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆