ls | ws - c
ls | wc - w
ls | wc - l
ls | wc E. None of the above
Answer is Wrong!
Answer is Right!
The correct answer is: ls | wc -l
.
The ls
command lists the
|
character is a pipe, which sends the output of the ls
command to the input of the wc
command. The wc
command counts the number of lines, words, and characters in its input. The -l
option tells wc
to count lines only.
The other options are incorrect. ws -c
is
ls | wc -w
would count the number of words in the output of ls
, which would not be the number of files in the current directory. ls | wc -l
would count the number of lines in the output of ls
, which would also not be the number of files in the current directory.