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!

Ask a Question

Get help from others!

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