ls | wc -l
How many files are in the current directory on my hard drive?
The command ls gives me a list of files (ls stands for “list stuff”)
the vertical line is a pipe. This means the standard output of the left side of the pipe is sent (like in a pipe) to the standard input of the right side.
wc means “word count” … the default output is the number of lines, nmber of words, and number of bytes for a file or for standard input. the -l option puts out only the number of lines. That, then, is the number of files.
Try it!




