Now I can .c you
What happens when you type ls *.c
--
ls is a command Written by Richard M. Stallman and David MacKenzie. Yes, our favorite Hippe creator of the GNU project.
The philosophy of Unix is that “everything is a file”, and the ls command applies it. This command searches in the directory and list the files founded in a special file named standard output (stdout). Normally this output goes to the screen where we can see it.
Syntax
ls [OPTIONS] ... [FILE] ...
ls use can use one or more options to customize the selected file(s).
Wildcards
ls
use wildcard to customize the output ls *c
list all the files with .c
extension for example
*.c
If the input use the *
, ls will select all the files in the directory and if it use *.c
it will select all the files that ends with *.c. The next line will show an example of the output of ls vs ls *c
ls
$ ls
lib.c lib.h main.c make o.out usr.c usr.h
ls *c
$ ls *c
lib.c main.c usr.c
ls ignores the lib.h
, make
, o.out
and usr.h files