SD 212 Spring 2024 / Homeworks


hw06: Reading about pipes

  • Due before the beginning of class on Monday, January 22

Today’s homework asks you to do a few different things, and then fill in another wonderful markdown file to show what you’ve done.

  • (Optional) Install some extra command-line tools in WSL

    Most of the command line tools we are using come pre-installed with every version of Linux. But a few are not. They are available on the lab machines and ssh.cs, but if you want them on your laptop too, then open a WSL/Ubuntu terminal and run these commands. (When you are asked, enter your WSL/Ubuntu password that you chose):

    sudo apt update
    sudo apt install -y jq moreutils bsdmainutils bat tree cowsay csvkit tldr mlocate aspell bc diction groff
  1. Read TLCL Chapter 6 “Redirection”

    Note that this reading should be largely reviewing and reinforcing what we already covered in class, rather than introducing new concepts. So you should read carefully and expect to understand it completely.

    Answer “yes” to indicate that you did the reading.

  2. What is “standard error”?

    1. An error message indicating a program does not work properly
    2. A special location (default goes to the screen) where status messages are printed
    3. A file in the directory /var/log where a program’s error messages are stored
    4. A terminal that is used for debugging when a program crashes
  3. Assume congress.txt is a file that contains information on elected representatives like

    firstname,lastname,state,party

    What would the following pipeline do?

    cat congress.txt | cut -d',' -f3 | sort | uniq | wc -l
    1. Get the number of different states in the file
    2. Get the number of felines that have been elected to office
    3. Print out all party affiliations in sorted order
    4. Show how many members of each party are represented

Submit command

To submit files for this homework, run one of these commands:

submit -c=sd212 -p=hw06 hw06.md 
club -csd212 -phw06 hw06.md
Download the file hw06.md to fill in and submit for this homework