terminal.cab

All commands

wc

Topic: Text

Program: wc

Counts lines, words and characters.

Package: text

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
  • --files0-from needs a value not in the simulator yet

    Explanation to come

  • -L, --max-line-length not in the simulator yet

    Explanation to come

  • --total needs a value not in the simulator yet

    Explanation to come

  • --version not in the simulator yet

    On a real system it prints the version of the program.

Examples

From the lesson Chaining commands
grep 404 projects/website/server.log | wc -l
3

Try it in the terminal

From the lesson Finding lines, finding differences
wc -l logs/app.log
17 logs/app.log
grep ERROR logs/app.log | wc -l
2

Try it in the terminal

From the lesson Steering the streams
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

Try it in the terminal

From the command of the day: wc -l
wc -l logs/app.log
8 logs/app.log

Try it in the terminal

Where you learn it

Lessons

Command of the day

All commands