02. The File System and the Shell

This week …

A shell is how we talk to the operating system; it is the thing that executes programs of all kinds for us when we tell it to; and it is how we see where we are in the file system and act on those files. In a plain-text world we will spend quite a bit of time talking to the shell via a command-line interface. This week we see the elements of how to do that, and what it buys us.

The shell’s interface is a command interpreter. Languages like R and Python work in the same way when you are writing them. We will also see how the shell implements its own version of the sort of thing you may have already seen when using R, namely, many single-purpose commands (more or less equivalent to R’s functions) that can be chained or pipelined together into sequences that can do quite complex tasks one piece at a time.

Two Videos

  • Five minutes from Jenny Bryan on how to name things:
  • The Unix way of thinking. You can watch the whole video for a really great dose of 1970s/1980s Corporate Video Nostalgia (and a lot of useful information), but in particular watch the seven minutes from about 04:56 in, when Brian Kernighan (the guy in the blue pullover) explains the idea of the Unix way of thinking, and gives an example.

Reading

  • Brian W. Kernighan UNIX: A History and a Memoir (Kindle Direct Publishing, 2019), https://www.cs.princeton.edu/~bwk/memoir.html. Excerpts. (PDF is on Canvas.)
  • Dennis M. Ritchie and Ken Thompson “The UNIX Time-Sharing System,” Communications of the ACM 17, no. 7 (July 1974): 365–375, doi:10.1145/361011.361061. Read sections 1 to 3.5 and 8. (PDF is on Canvas.)

Assignments

There is an assignment due on Sunday, September 6th.

Slides