The flag is described in the
ls man page like so (emphasis is mine) ...
do not list implied entries matching shell PATTERN
The man page doesn't have much to say about "implied" so what the heck does it mean? An implied entry (file, directory, etc.) is an entry that
ls will return without you having explicitly provided an argument that matches that entry. A match can either be the actual name of the entry (
ls books_tom.csv ... using your example) or a glob that matches it (
ls *tom.csv, for instance).
Taking this to its logical limit, if you call
ls with no arguments everything that is returned is implied! I'm assuming that the most common use of
--ignore is with such an otherwise unadorned
ls call because it is the easiest way to do a "list everything but X" operation...at least if you want to avoid using any other commands.
So, let's look at your command. With
ls *.csv --ignore="*tom*" "books_tom.csv" is explicitly referenced by way of the matching pattern
ls --ignore="*tom*", per the previous paragraph, everything in the directory is implied thus "books_tom.csv" will not be displayed.
If you have extended globbing available in your shell (with bash you can enable with
shopt -s extglob) you can achieve what you want by crafting a pattern that will exclude 'tom'. For example
ls books_!(tom).csv would show
books_abby.csv but not
(Of course, you can use other tools like
find, pipe to
grep -v, etc...I'm just giving a pure