If the video is not available for viewing, try turning off the ad blocker.

Important notes

  1. Redirections operate on standard input and output (STDIN, STDOUT). Read more about standard input/ouput here or just google "unix stdin stdout".
  2. In addition to >, which directs an output into a file, there is also >>, which appends the file, or, in other words, adds stuff to the end of the file.
  3. wc is used to count characters, words and lines. wc -l counts lines only.
  4. uniq eliminates repeated lines (outputs the file with adjacent identical lines collapsed to one). It only works when repeated lines come together in a single continuous block. Example: sort file.txt | uniq

Lesson notes

  • > to redirect an output into a file (e.g. ls /var/logs > logs.txt)
  • < to redirect a file (e.g. sort < names.txt)
  • | to connect two commands with a pipe (e.g. ls | grep)
We teach programming in a new way. Check out "Intro to Programming" course.

Hexlet

Learn about why Hexlet is so good →