Learn from stackexchange

Highlight the three last updated files in ls output

grep --color -E --"$(ls -rtl | tail -n3)|$"<(ls -l)
or
ls -l|grep --color -E  "$(ls -rtl | tail -n3)|$"

It uses grep with highlight on input ls -l and uses a regular expression to search for either of the inputs for the three oldest command. It also search for the end-of-line $ in order to print the whole file.

 
 
posted on 2012-10-10 14:02  Zaiping  阅读(161)  评论(0编辑  收藏  举报