Reading This Book in the Terminal
You can also read this book in your terminal, right next to the command-line tools it’s about. dsatcl is a program with the whole book inside it: the text, the figures, and every command and its output, with the same colors as on the website. You can copy a command, or run it in a terminal next to the book, without leaving the keyboard. It works offline, it starts in an instant, and it’s already installed in the Docker image.
Installing
Inside the Docker image from Chapter 2, dsatcl is already installed:
dsatcl --version
dsatcl 0.1.0 (book last updated on November 30, 2026)
On your own computer, the easiest way is with uv, which runs it without installing it first:
uvx dsatcluv tool install dsatcl installs it, and so does pipx install dsatcl. You don’t need Python for anything else: the package only contains the program. There are also binaries for Linux, macOS, and Windows on GitHub.
A First Look
Run dsatcl to open the book where you left off, or dsatcl -c 5 to open Chapter 5:
dsatcl -c 5
Data Science at the Command Li… │ ┃
Welcome │ 5 Scrubbing Data │
Foreword │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
Preface │ │
1 Introduction │ Two chapters ago, in the first step of the OSEMN model for │
2 Getting Started │ data science, we looked at obtaining data from a variety of │
3 Obtaining Data │ sources. This chapter is all about the second step: scrubbing │
4 Creating Command-line Tools │ data. You see, it’s quite rare that you can immediately │
▸5 Scrubbing Data │ continue with exploring or even modeling the data. There’s a │
5.1 Overview │ plethora of reasons why your data first needs some cleaning, │
5.2 Transformations, Transf… │ or scrubbing. │
5.3 Plain Text │ │
5.3.1 Filtering Lines │ For starters, the data might not be in the desired format. For │
5.3.2 Extracting Values │ example, you may have obtained some JSON data from an API, but │
5.3.3 Replacing and Delet… │ you need it to be in CSV format to create a visualization. │
5.4 CSV │ Other common formats include plain text, HTML, and XML. Most │
5.4.1 Bodies and Headers … │ command-line tools only work with one or two formats, so it’s │
5.4.2 Performing SQL Quer… │ important that you’re able to convert data from one format to │
5.4.3 Extracting and Reor… │ another. │
5.4.4 Filtering Rows │ │
5.4.5 Merging Columns │ Once the data is in the desired format, there could still be │
5.4.6 Combining Multiple … │ issues like missing values, inconsistencies, weird characters, │
5.5 Working with XML/HTML a… │ or unnecessary parts. You can fix these by applying filters, │
5.6 Summary │ replacing values, and combining multiple files. The command │
5.7 For Further Exploration │ line is especially well-suited for these kind of │
6 Project Management with Ma… │ transformations, because there are many specialized tools │
7 Exploring Data │ available, most of which can handle large amounts of data. In │
Welcome! Press ? for the keys, Space e for the outline, Ctrl-p to sea… ▶ terminal term 8/16 Top
On the left is the outline: the chapters, and the sections of the chapter you’re reading. The status line at the bottom shows where you are, where commands go (▶), the colors, and how far you are in the chapter.
Getting Around
dsatcl uses the keys of Vim, so if you know Vim (or less), you’ll feel at home:
| Key | What |
|---|---|
j k Ctrl-d Ctrl-u |
Down and up a line, half a screen |
gg G |
Top and bottom |
]] [[ |
Next and previous section |
]c [c |
Next and previous code block |
> < |
Next and previous chapter |
Space e |
Show or hide the outline |
za |
Fold a section, a callout, or long output |
Ctrl-o |
Go back |
? |
All keys |
q |
Quit |
The mouse works too: scroll with the wheel, and click links, sections in the outline, and figures.
Searching
/ searches the current chapter, and Ctrl-p searches the whole book. When you start with @, it searches the command-line tools, so @csvsql goes straight to its entry in the list of command-line tools:
Data Science at the Command Li… │ ┃
W╭ Search the book (#headings $commands @tools !figures ^footnotes) ────────────────────────────╮ │
F│ › csvsql▏ 36 results │ │
P│──────────────────────────────────────────────────────────────────────────────────────────────│ │
1│ @ csvsql │ │
2│ List of Command-Line Tools › csvsql │ │
3│ $ csvsql datatypes.csv │ │
4│ 7 Exploring Data › 7.2.3 Feature Names and Data Types │ │
▸5│ $ csvsql venture.csv │ │
│ 7 Exploring Data › 7.2.3 Feature Names and Data Types │ │
│ $ csvsql --help │ │
│ List of Command-Line Tools › csvsql │ │
│ $ csvsql --query "SELECT * FROM tips WHERE bill > 40 AND day LIKE 'S%'" tips.csv │ │
│ 5 Scrubbing Data › 5.4.4 Filtering Rows │ │
│ $ csvsql --query 'SELECT i.sepal_length, i.sepal_width, i.species, m.usda_id FRO │ │
│ 5 Scrubbing Data › 5.4.6.2 Joining │ │
│ $ csvsql --query 'SELECT borough, SUM(count) AS count FROM stdin GROUP BY boroug │ │
│ 8 Parallel Pipelines › 8.4.4 Processing Files on Remote Machines │ │
│ $ type csvsql │ │
│ List of Command-Line Tools › csvsql │ │
│ $ seq 5 | header -a val | csvsql --query "SELECT SUM(val) AS sum FROM stdin" │ │
│ 5 Scrubbing Data › 5.4.2 Performing SQL Queries on CSV │ │
│ $ < iris.csv csvsql --query "SELECT sepal_length, petal_length, "\ │ │
│ 5 Scrubbing Data › 5.4.3 Extracting and Reordering Columns │ │
╰──────────────────────────────────────────────────────────── ↑↓ choose · Enter go · Esc close ╯ │
6 Project Management with Ma… │ transformations, because there are many specialized tools │
7 Exploring Data │ available, most of which can handle large amounts of data. In │
Welcome! Press ? for the keys, Space e for the outline, Ctrl-p to sea… ▶ terminal term 8/16 Top
Enter goes to the line, and n goes to the next match. On the command line, dsatcl tool csvsql opens that entry right away.
Links and Footnotes
Enter follows the link on the cursor line, and f shows a label for every link on the screen. Cross-references open in the reader; websites open in your browser. The references in this book are footnotes, and K shows them where you’re reading.
Copying and Running Commands
This is why I made dsatcl. yc copies the commands of the code block at the cursor, without the dollar signs and without the ➊ markers, so you can paste them right away. s sends them to a terminal instead: to another pane when you use tmux, and otherwise to a terminal inside the reader. S also runs them.
Data Science at the Command Li… │ ┃
Welcome │ This chapter starts with the following files: │
Foreword │ │
Preface │ ⧉ copy ▶ send │
1 Introduction │ $ cd /data/ch05 │
2 Getting Started │ │
3 Obtaining Data │ $ l │
4 Creating Command-line Tools │ total 200K │
5 Scrubbing Data │ -rw-r--r-- 1 dst dst 164K Nov 26 11:54 alice.txt │
▸ 5.1 Overview │ -rw-r--r-- 1 dst dst 4.5K Nov 26 11:54 iris.csv │
5.2 Transformations, Transf… │ -rw-r--r-- 1 dst dst 179 Nov 26 11:54 irismeta.csv │
5.3 Plain Text │ -rw-r--r-- 1 dst dst 160 Nov 26 11:54 names-comma.csv │
5.3.1 Filtering Lines │ -rw-r--r-- 1 dst dst 129 Nov 26 11:54 names.csv │
5.3.2 Extracting Values │ -rw-r--r-- 1 dst dst 7.8K Nov 26 11:54 tips.csv │
5.3.3 Replacing and Delet… │ -rw-r--r-- 1 dst dst 5.1K Nov 26 11:54 users.json │
5.4 CSV │ │
5.4.1 Bodies and Headers … │╭ /usr/bin/zsh · Ctrl-w w: type here ────────────────────────────╮
5.4.2 Performing SQL Quer… ││total 200K │
5.4.3 Extracting and Reor… ││-rw-r--r-- 1 dst dst 164K Dec 2 15:47 alice.txt │
5.4.4 Filtering Rows ││-rw-r--r-- 1 dst dst 4.5K Dec 2 15:47 iris.csv │
5.4.5 Merging Columns ││-rw-r--r-- 1 dst dst 179 Dec 2 15:47 irismeta.csv │
5.4.6 Combining Multiple … ││-rw-r--r-- 1 dst dst 160 Dec 2 15:47 names-comma.csv │
5.5 Working with XML/HTML a… ││-rw-r--r-- 1 dst dst 129 Dec 2 15:47 names.csv │
5.6 Summary ││-rw-r--r-- 1 dst dst 7.8K Dec 2 15:47 tips.csv │
5.7 For Further Exploration ││-rw-r--r-- 1 dst dst 5.1K Dec 2 15:47 users.json │
6 Project Management with Ma… ││$ │
7 Exploring Data │╰────────────────────────────────────────────────────────────────╯
Terminal opened (Ctrl-w w switches to it) ▶ terminal term 8/16 3%
Inside the Docker image, the commands run right there. On your own computer, with Docker installed, dsatcl asks once whether to run them in the Docker image or on your computer. Ctrl-w w moves between the book and the terminal, and Space t shows or hides the terminal.
Colors
By default, dsatcl uses the colors of your terminal, so the book looks like everything else in it. Space c switches to the colors of the book, and Space l switches between its light and dark colors. Space k gives code blocks a rounded border.
Data Science at the Command Li… │ ┃
Welcome │ This chapter starts with the following files: │
Foreword │ │
Preface │ ⧉ copy ▶ send │
1 Introduction │ $ cd /data/ch05 │
2 Getting Started │ │
3 Obtaining Data │ $ l │
4 Creating Command-line Tools │ total 200K │
5 Scrubbing Data │ -rw-r--r-- 1 dst dst 164K Nov 26 11:54 alice.txt │
▸ 5.1 Overview │ -rw-r--r-- 1 dst dst 4.5K Nov 26 11:54 iris.csv │
5.2 Transformations, Transf… │ -rw-r--r-- 1 dst dst 179 Nov 26 11:54 irismeta.csv │
5.3 Plain Text │ -rw-r--r-- 1 dst dst 160 Nov 26 11:54 names-comma.csv │
5.3.1 Filtering Lines │ -rw-r--r-- 1 dst dst 129 Nov 26 11:54 names.csv │
5.3.2 Extracting Values │ -rw-r--r-- 1 dst dst 7.8K Nov 26 11:54 tips.csv │
5.3.3 Replacing and Delet… │ -rw-r--r-- 1 dst dst 5.1K Nov 26 11:54 users.json │
5.4 CSV │ │
5.4.1 Bodies and Headers … │╭ /usr/bin/zsh · Ctrl-w w: type here ────────────────────────────╮
5.4.2 Performing SQL Quer… ││total 200K │
5.4.3 Extracting and Reor… ││-rw-r--r-- 1 dst dst 164K Dec 2 15:47 alice.txt │
5.4.4 Filtering Rows ││-rw-r--r-- 1 dst dst 4.5K Dec 2 15:47 iris.csv │
5.4.5 Merging Columns ││-rw-r--r-- 1 dst dst 179 Dec 2 15:47 irismeta.csv │
5.4.6 Combining Multiple … ││-rw-r--r-- 1 dst dst 160 Dec 2 15:47 names-comma.csv │
5.5 Working with XML/HTML a… ││-rw-r--r-- 1 dst dst 129 Dec 2 15:47 names.csv │
5.6 Summary ││-rw-r--r-- 1 dst dst 7.8K Dec 2 15:47 tips.csv │
5.7 For Further Exploration ││-rw-r--r-- 1 dst dst 5.1K Dec 2 15:47 users.json │
6 Project Management with Ma… ││$ │
7 Exploring Data │╰────────────────────────────────────────────────────────────────╯
The book's light colors (Space c: your terminal's colors) ▶ terminal book·light 8/16 3%
Figures appear as images in terminals that support it, such as Kitty, Ghostty, WezTerm, and iTerm2. In other terminals, they’re drawn with colored blocks.
Other Books
dsatcl is tomes with this book built in, and tomes reads any book made with Quarto. Space o lists free books, such as R for Data Science and Python for Data Analysis.
On the Command Line
dsatcl can also print parts of the book, which you can then combine with other command-line tools:
dsatcl toc | head -n 12
Welcome
Description
Praise
Dedication
About the Author
Colophon
Foreword
Preface
What to Expect from This Book
Changes for the Second Edition
How to Read This Book
Who This Book Is For
dsatcl search "word frequency" -n 3
No matches for "word frequency"
dsatcl commands 5 | head -n 8
# 5 Scrubbing Data
# 5.1 Overview
cd /data/ch05
l
# 5.2 Transformations, Transformations Everywhere
seq 100 |
dsatcl cat 5 | less -R lets you read a chapter with less.