wc
Program: wc
Counts lines, words and characters.
Usage
wc [OPTION]... [FILE]...
Description
Count lines, words and bytes of each FILE, and give a total for more than one FILE. A FILE named -, or no FILE, means the keyboard or pipe.
Options in the simulator
4 more options of the real program, not in the simulator yet
Examples
grep 404 projects/website/server.log | wc -l
3 wc -l logs/app.log
17 logs/app.log
grep ERROR logs/app.log | wc -l
2 grep ERROR logs/app.log | wc -l
2
ls -lt logs | head -n 2
total 8
-rw-r--r-- 1 lerner lerner 621 Oct 17 09:41 app.log wc -l logs/app.log
8 logs/app.log Where you learn it
Lessons
- Chaining commands Terminal start
- Finding lines, finding differences Linux Basics, Module 3: Text tools
- Steering the streams Linux Basics, Module 4: Pipes and redirection