Wednesday, September 02, 2015

Unix ls command - How to Exclude Certain Patterns using Wildcard?

Let's say you have a directory where there are too many files/folders having similar names and you want to exclude them during an ls operation. The command to use is as follows:

ls --ignore="PATTERN*"

Below is an example where there are folders named run_* and other files. The results obtained after typing plain ls and with the exclude options are shown below:


With the option: (Note the usage of the wildcard)