Introduction to Bioinformatics and Computational Genomics

Week 2The command line

The shell is the interface to every tool in this course. Read files, filter them, count things, and chain small tools into one answer.

Questions this week answers

  • Why would anyone type commands when a program with buttons exists?
  • What does uniq need done to its input before it works at all?
  • How do you keep an answer instead of watching it scroll past?

By the end of this week you can

  • Move around a filesystem and inspect files without opening them
  • Filter lines with grep and columns with cut
  • Chain tools with pipes and redirect output to a file
  • Count and group with sort, uniq -c and wc
0 of 8 done
  1. The shell is not a worse GUI

    • It is repeatable: a pipeline you typed once can be run again on a thousand files.
    • It is composable: every tool reads text and writes text, so any tool can feed any other.
    • It is what every bioinformatics tool in this course expects.
    1 / 4

What should survive this week

  • The shell is repeatable and composable: every tool reads text and writes text, so any tool can feed any other.
  • grep selects rows, cut selects columns. Almost every question in this course is a combination of the two.
  • sort before uniq -c, always. uniq only collapses adjacent duplicates, so unsorted input silently undercounts.
  • > truncates and writes, >> appends, | feeds the next command rather than a file.