Core Utilities and the Unix Data Model

4. Core Utilities and the Unix Data Model#

This chapter focuses on the Unix idea that text streams, files, and small composable utilities can solve large practical problems.

  • Streams: Follow data through standard input, output, and error.

  • Inspection: Choose commands that reveal enough of a file without overwhelming the terminal.

  • Filtering: Search and select text with patterns and regular expressions.

  • Transformation: Reshape text with tools such as sort, uniq, cut, sed, and awk.

  • Pipelines: Combine commands so each tool performs one clear step.

Chapter Video

How to Use Redirection and Pipelines in Bash (9:50) by Microsoft Developer

Hosted on YouTube; property of its original creator, embedded here for educational reference only.

Learning Objectives

By the end of this chapter, you will be able to:

  1. Explain how the Unix data model treats files and streams.

  2. Inspect text and binary data with standard command-line tools.

  3. Combine commands with pipes and redirection.

Chapter Flow

Glossary

#

Term

Explanation

1

Standard input

The default input stream read by a command.

2

Standard output

The default stream where a command writes normal output.

3

Standard error

The stream where a command writes diagnostics and errors.

4

Text stream

A sequence of text data flowing into or out of a process.

5

Pipeline

A chain of commands connected so output from one becomes input to the next.

6

Pipe

The `

7

Redirection

Shell syntax that sends input or output to files or other streams.

8

cat

A command that writes file contents to standard output.

9

less

A pager for reading text interactively.

10

head

A command that shows the beginning of a file or stream.

11

tail

A command that shows the end of a file or stream.

12

file

A command that reports the likely type of a file.

13

wc

A command that counts lines, words, and bytes.

14

grep

A command that searches text for matching lines.

15

Regular expression

A pattern language for matching text.

16

find

A command that searches directory trees for matching files.

17

sort

A command that orders lines of text.

18

uniq

A command that collapses or counts adjacent duplicate lines.

19

sed

A stream editor commonly used for substitutions and line filtering.

20

awk

A pattern-action language for field-oriented text processing.