Pipe Commands in Shell

Level 235 keystrokes

Pipe (|) sends the output of one command as input to another.

Shell code

# cat sends file.txt to grep, which keeps only lines containing error
# wc -l counts those lines: 42 (grep -c error file.txt gives the same)
1cat file.txt | grep "error" | wc -l

Output

42
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Shell code and how often they appear.

  • "× 2
  • |× 2
  • -× 1
  • .× 1

More Shell examples at level 2

← Shell typing practice