watch tail -20 ls -ltr?

Unix & Linux Asked by Dong gi Kang on December 17, 2020

I would like to see the latest content of a directory.

I tried watch tail -20 ls -ltr ./{directory} it is not working.

Is there a way to constantly shows the content of a directory like watch command?

One Answer

You need to generate the directory list first (ls), then limit it (tail) and watch the whole thing:

watch "ls -ltr ./ | tail -20"

Correct answer by user1794469 on December 17, 2020

Add your own answers!

Related Questions

i need to generate ansible-playbook using jinja2 with csv file in ansible

1  Asked on December 6, 2021 by vithushan-rasalingam


curl jq get value from field name

2  Asked on December 6, 2021


Some RUN-Commands in UDEV-Rule are ignored

1  Asked on December 6, 2021 by niels


NFS Share on Centos 7 Fails to automount

2  Asked on December 4, 2021 by steelmonkey


behavior of ServerAliveInterval with ssh connection

2  Asked on December 4, 2021 by kumarprd


scp using ssh tunneling

4  Asked on December 4, 2021 by mano-mini


How to get nth result from find?

2  Asked on December 4, 2021 by ddlfmbqrc


Use & (ampersand) in single line bash loop

4  Asked on December 3, 2021 by ljs-dev


syslog-ng fail to start

1  Asked on December 3, 2021 by satch_boogie


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP