Linux Labs

First steps / Stage 12 of 15

Pipelines: an answer from several commands

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 7 · summary · 2 min

Summary

  • | passes stream 1 of the command on the left to the standard input of the command on the right; a filter given no file name reads that input.
  • Repeats in a column are counted with cut … | sort | uniq -c: uniq glues together only neighbouring lines, so sort goes before it.
  • sort -rn | head -n 3 keeps the three most frequent lines. A long pipeline is built one link at a time, checking the output through head.
  • The colleague's command at the start of the lesson has five links: the addresses, sorting, counting, ordering from high to low and the top three lines.
Ubuntu 24.04
Loading…