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, andawk.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:
Explain how the Unix data model treats files and streams.
Inspect text and binary data with standard command-line tools.
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 |
|
A command that writes file contents to standard output. |
9 |
|
A pager for reading text interactively. |
10 |
|
A command that shows the beginning of a file or stream. |
11 |
|
A command that shows the end of a file or stream. |
12 |
|
A command that reports the likely type of a file. |
13 |
|
A command that counts lines, words, and bytes. |
14 |
|
A command that searches text for matching lines. |
15 |
Regular expression |
A pattern language for matching text. |
16 |
|
A command that searches directory trees for matching files. |
17 |
|
A command that orders lines of text. |
18 |
|
A command that collapses or counts adjacent duplicate lines. |
19 |
|
A stream editor commonly used for substitutions and line filtering. |
20 |
|
A pattern-action language for field-oriented text processing. |