Question discussion

In a Linux shell, what does the command ls | wc -l do?

2530Medium DSSSB TGT Computer Science 0 replies 1 views
0

In a Linux shell, what does the command ls | wc -l do?

  • ALists the files and then deletes them
  • BWrites the output of ls into a file named wc
  • CCounts the number of lines output by ls, i.e. the number of entries in the current directory
  • DLists only the files whose names contain the letter l
Correct answer: C

Explanation

The pipe symbol | sends the output of ls as the input of wc -l, which counts lines, so the result is the number of entries listed (ls prints one entry per line when its output goes to a pipe).

Discussion 0

Nobody has replied yet. Start the discussion!