Tsallaka zuwa abun ciki
Justice Tech School

Pipes and Text Tools

A pipe | sends one command output to the next. Redirect with > (write), >> (append) and < (read). grep filters, sort orders, uniq removes repeats, wc counts and cut or awk pick columns.

Example
printf "pear\napple\npear\nfig\n" | sort | uniq -c
printf "a,1\nb,2\n" | cut -d, -f2
printf "one\ntwo\nthree\n" | grep t | wc -l
echo "hello" > /tmp/b_demo.txt
echo "world" >> /tmp/b_demo.txt
cat /tmp/b_demo.txt
rm /tmp/b_demo.txt

Result

      1 apple
      1 fig
      2 pear
1
2
2
hello
world

Exercise

Which command counts lines, words or bytes?

ls |  -l

Quiz Test

What does >> do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.