17 Apr

Power of grep

How to highlight results in ls output:

ls|grep -E --color "sh$|$"

This will highlight all files with *.sh extension in current directory.

Where -E means that we’re matching entries with regex,
|$ means that we don’t want to skip entries that do not match our regex (passing pipe further and closing it with dollar sign).