I don't care!

Roy Lichtenstein's Drowning Girl

Roy Lichtenstein’s Drowning Girl

One of the things I’ve been doing over the past week is explore Odin Project’s Web Development 101 curriculum. It’s good stuff! I particularly enjoyed reading the Bastards Book chapters on web scraping and web inspecting, among other things.

Following Odin’s chapter on how the web works is a section that delves into the command line. I just finished the first item on the “syllabus” for this section (Codecademy’s command line tutorial) and it’s given me a new layer of understanding, yay. Thought I’d record some of my notes here before I jump back and flail around in the ocean of Things I Don’t Know.

Codecademy’s tutorial first acquainted me with the concept of re-routing standard input, standard output, and standard error.

This nugget redirects stdout to a file:

$ echo "zane, zane, zane" > all_the_madmen.txt

This nugget redirects the stdout of the cat command into the text file on the right (overwriting the original contents of the latter file):

$ cat all_the_madmen.txt > man_who_sold_the_world.txt

This nugget appends the stdout of the cat command to the text file on the right (without overwriting any original content):

$ cat black_country_rock.txt >> man_who_sold_the_world.txt

This nugget takes the stdin from the file on the right and inputs it into the program on the left; so, after_all.txt is the stdin for the cat command, and the stdout appears in the terminal:

$ cat < after_all.txt

This nugget below pipes the stdout of the cat command as stdin to the command on the right, wc (which outputs the number of lines, words, and characters in the text file). Multiple |s can be chained together.

$ cat running_gun_blues.txt | wc

More in a later post… someday.