Skip to content

06_Terminal — seeing and making bytes without a language

Level: 101 → 201 · for anyone with a terminal

xxd and od were taught in chapter 1 because nothing later works without them. This chapter is the rest of the toolbox: putting known bytes on a pipe, the last byte of a text file and everything that depends on it, reading a dump's other columns without being lied to, re-encoding a file, the locale that silently sets every tool's default, the tool that guesses, the bytes at offset 0 that decide whether a file runs at all, why binary is a reader's verdict and not something a file is, and the syscall that tells a program whether anyone is watching.

# Lesson The question it answers Status
1 printf writes bytes How do I put exactly the bytes I mean in front of xxd? written
2 The trailing newline Why did cat print nothing for a file that is not empty? written
3 A character and its bytes on one line How do I see the letter and its hex at the same time? written
4 Inspecting a file Which column of a dump is the file, and which ones are the tool guessing? written
5 iconv How do I re-encode a file, and what does its refusal mean? written
6 Locale and LC_CTYPE What is the terminal's default encoding, and which tools change with it? written
7 file guesses Why is file's answer an inference, and when is it sure? written
8 File type is four questions Who decides what kind of file this is, and why do they disagree? written
9 The first two bytes Why does my script say /bin/sh is missing when it is right there? written
10 Binary is a verdict, not a property I named it .bin, so why do file and git call it text? written
11 Terminal hyperlinks, and the URI that is not one What is in a clickable filename, and what did it do to the accent? written
12 A pipe is not a terminal Why did piping my program into cat change what it printed? written