Why the following doesn't include hidden files ?
ls -a *vim*
that will return
ls: cannot access '*vim*': No such file or directory ls -a | grep vim .vim .vimrc
If you are explicitly looking for hidden files use a pattern that starts with dot,
Then there's no need for the -a flag.
It's the shell that finds the filenames matching the pattern, not
ls itself. So you have to get the shell to include names starting with a dot, either using
shopt -s dotglob before the
ls command, or by specifically including the dot in the pattern:
.*vim*. Though note that if the pattern matches directories,
ls will list their contents (and this is where
-a will matter, since now it's
ls listing the files). To prevent that, use