WBJECA 2025 — Computer PYQ
WBJECA | Computer | 2025Which command is used to find the number of lines, words and characters in a file in Unix?
Choose the correct answer:
- A.
count
- B.
wc
(Correct Answer) - C.
nl
- D.
cat
wc
Explanation
In Unix-like systems, the wc (word count) command is the standard utility used to compute the number of lines, words, and bytes/characters in a given file or stream of text.
When you run the command wc filename, it outputs the results in a specific order:
Number of lines (L)
Number of words (W)
Number of bytes/characters (C)
The mathematical output can be represented as a vector:
Output={L,W,C}
If you wish to isolate a specific metric, you can use flags with the command. For example, to count only the lines, the command is wc -l:
L=count of lines
count: This is not a standard Unix command for file statistics.
nl: This command is used to number the lines of a file while displaying its content.
cat: This command is used to concatenate and display the entire contents of a file to the standard output.
By default, without any flags, wc provides a comprehensive summary of the file's size and contents, making it the correct choice for this task.

