The reason is that a leading dot is the convention for "hidden file", and file globbing (which is the name for the use of *
as "any number of any characters" and ?
as "any one character" and a few others) specifically excludes a leading dot because it means "hidden file".
If you write ls -l .*
you will match .bashrc
, but you will also match the special hidden files .
and ..
which are directories, so to show hidden files you will want something along these lines:
ls -ld .*
ls -l .[^.]*
ls -A | grep bash
ls -A *bash*
will not show you .bashrc
because the file globbing is done before the -A
option takes effect.
If you want to change the way file globbing works with hidden files you can execute shopt -s dotglob
, either just in the shell to test, or put in your .bash_profile or .bashrc to have it always effective.