Command Line
Last updated on 2026-10-07 | Edit this page
Overview
Questions
- How can I make my results easier to reproduce?
Objectives
- Introduce Zipf’s Law project.
- Introduce git tags and branches
- Illustrate pain and fragility of building with editor and sequences of command line commands.
Let’s imagine that you are writing code for a research project to test Zipf’s Law.
Zipf’s Law
The most frequently-occurring word occurs approximately twice as often as the second most frequent word. This is [Zipf’s Law][zipfs-law].
We have setup a git repository with a sequence of branches to step through the tutorial today. You should start by cloning the repository
OUTPUT
Cloning into 'work_dir'...
done.
Change to the new directory, checkout the branch 06-documentation, and list the branches
OUTPUT
* 06-documentation
remotes/origin/01-command-line
remotes/origin/02-first-makefile
remotes/origin/03-no-hands
remotes/origin/04-testing
remotes/origin/05-standards
remotes/origin/06-documentation
remotes/origin/HEAD -> origin/06-documentation
remotes/origin/main
Today, we will start with the branch 01-command-line and step through the numbered branches arriving at the branch 06-documentation which uses all of the tool we will introduce.
First let’s peek at the final results
View the result with (depending on your OS)
View the result with (depending on your OS)
Let’s take a couple of minutes to skim the document.
Now clean up and start with the 01-command-line branch
The output of the last command should be
OUTPUT
README abyss.txt analyze.py isles.txt local.bib report.tex
Now build the document pdf by following the instructions in the README file:
First run the analysis script and display the first ten lines of the results in abyss.dat
BASH
$ python analyze.py abyss.txt abyss.dat abyss.pdf
$ python analyze.py isles.txt isles.dat isles.pdf
$ head -10 abyss.dat
Then use an editor to copy results from the screen into report.tex
Now run latexmk to build the pdf
If you are not sure you did it right, you can start over by running:
or if you have clobbered some source files:
$ rm * ; git checkout .
- We hope to improve on executing commands from a README