The names of hidden files start with
. (dot), there are none that start with
b. To list names starting with
$ ls .b*
This will also list the contents of any directory whose name starts with
.b. Note that
-a is not needed here as we explicitly give a filename pattern for the shell to match. Since the pattern starts with
. (dot), it will match hidden files. The expanded pattern will be given to
ls for processing.
To avoid listing the contents of directories, use
$ ls -d .b*
The above solutions will give an error if no name matches the pattern.
To only list the names of regular files whose names start with
$ for name in .b*; do test -f "$name" && printf '%s\n' "$name"; done
To get the output in a similar way as with plain
ls (note that
column is a non-standard utility):
$ for name in .b*; do test -f "$name" && printf '%s\n' "$name"; done | column
The last couple of solutions will not print anything of no name matches the pattern.