Comprehensive and Detailed Explanation From Exact Extract:
wc -l counts the number of lines of input provided to it, which is commonly used to count the number of files when used with ls -l (excluding the header line). For example, ls -l /opt/application/home/ | wc -l gives the total count of lines, which corresponds to the number of files and directories (including the total line at the top).
Other options:
A. less is a pager utility.
B. tail -f shows the end of a file in real time.
C. tr -c translates or deletes characters, not for counting lines.
[Reference:, CompTIA Linux+ Study Guide: Exam XK0-006, Sybex, Chapter 4: "Working with the Command Line", Section: "Text Processing Commands", CompTIA Linux+ XK0-006 Objectives, Domain 1.0: System Management, , , , ]
Submit