Repeat command automatically in Linux

前端 未结 13 1683
滥情空心
滥情空心 2020-12-04 04:54

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
         


        
13条回答
  •  旧巷少年郎
    2020-12-04 05:24

    Watch every 5 seconds ...

    watch -n 5 ls -l

    If you wish to have visual confirmation of changes, append --differences prior to the ls command.

    According to the OSX man page, there's also

    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 man page can be found here

提交回复
热议问题