BeamerReveal
view release on metacpan or search on metacpan
test/2026-02-04-DRM/the_shell.tex view on Meta::CPAN
\end{itemize}
How to connect?
\end{block}
\end{column}
\begin{column}{0.48\columnwidth}
\begin{exampleblock}{Solution}\label{sec:orgc7d8ba1}
Use pipes (\texttt{|})
\begin{verbatim}
ls -l | grep txt | wc -l
\end{verbatim}
\end{exampleblock}
\end{column}
\end{columns}
\begin{alertblock}<2->{Philosophy}
"Do one thing well" â combine simple tools for complex tasks
\end{alertblock}
\end{frame}
\begin{frame}[label={sec:orgdcce901}]{How Pipes Work (Visual)}
\begin{block}{Data Flow}
\begin{center}
\begin{tikzpicture}[
node distance=1.2cm,
cmd/.style={rectangle, draw, very thick, minimum width=2.5cm, minimum height=1.5cm, align=center, fill=blue!20},
pipe/.style={->, very thick, blue!70}
]
% Commands
\node[cmd] (cmd1) {\textbf{command1}\\[0.3em]\texttt{ls -l}};
\node[cmd, right=of cmd1] (cmd2) {\textbf{command2}\\[0.3em]\texttt{grep txt}};
\node[cmd, right=of cmd2] (cmd3) {\textbf{command3}\\[0.3em]\texttt{wc -l}};
% Labels below
\node[below=0.2cm of cmd1, font=\small] {Output};
\node[below=0.2cm of cmd2, font=\small] {Filter};
\node[below=0.2cm of cmd3, font=\small] {Count};
% Pipes
\draw[pipe] (cmd1.east) -- node[above, font=\small\ttfamily] {stdout} (cmd2.west);
\draw[pipe] (cmd2.east) -- node[above, font=\small\ttfamily] {stdout} (cmd3.west);
\end{tikzpicture}
\end{center}
Each command runs simultaneously! Data flows left-to-right.\\
stdout of left becomes stdin of right.
\end{block}
\end{frame}
\begin{frame}[label={sec:org9335c9c},fragile]{Pipe Examples}
\begin{block}{Basic Piping}
\begin{verbatim}
# Count entries in directory listing
ls -1 | wc -l
# Search and sort
cat file.txt | grep "pattern" | sort
# Find largest files
du -h | sort -rh | head -10
# Process logs
cat access.log | grep "404" | wc -l
\end{verbatim}
\end{block}
\begin{alertblock}<2->{Career Note}
Data pipelines are used everywhere: ETL jobs, log analysis, build systems.
\end{alertblock}
\end{frame}
\begin{frame}[label={sec:org2b564ce},fragile]{Building Pipes Step-by-Step}
\begin{block}{Progressive Example}
\begin{verbatim}
# 1. See all lines
$ cat app.log
ERROR: connection failed
INFO: started successfully
ERROR: timeout
# 2. Filter errors only
$ cat app.log | grep ERROR
ERROR: connection failed
ERROR: timeout
# 3. Count errors
$ cat app.log | grep ERROR | wc -l
2
\end{verbatim}
\end{block}
\end{frame}
\begin{frame}[label={sec:org515477a},fragile]{Think-Pair-Share: Debug the Pipeline}
\begin{block}{The Goal}
Find all lines with "Error" in \texttt{app.log} and count them.
\end{block}
\begin{exampleblock}{Broken Commands}\label{sec:orgfd47812}
Identify the flaw in each command:
\begin{enumerate}
\item \texttt{grep "Error" app.log > wc -l}
\item \texttt{cat app.log | grep Error | wc}
\end{enumerate}
\end{exampleblock}
\begin{alertblock}<2->{Answers}
\begin{enumerate}[<+->]
\item \alert{Redirection Error:} \texttt{>} sends output to a \alert{file} named \texttt{wc}. Use \texttt{|} to send to a \alert{program}.
\item \alert{Ambiguous Output:} \texttt{wc} shows lines, words, AND characters. Use \texttt{wc -l} for just lines.
\end{enumerate}
\end{alertblock}
\end{frame}
\section*{xargs}
\label{sec:orge5a0e63}
\begin{frame}[label={sec:orge3a5cde},fragile]{xargs: Bridging the Gap}
\begin{definition}[What is it?]\label{sec:orge01f27c}
\texttt{xargs} builds and executes command lines from standard input. It converts lines of text into \alert{arguments} for another command.
\end{definition}
\begin{block}<2->{Why do we need it?}
Some commands (like \texttt{rm}, \texttt{mkdir}, \texttt{mv}) don't read from standard input. They only accept arguments. \texttt{xargs} bridges this gap.
\end{block}
\end{frame}
\begin{frame}[label={sec:orge4edf8e},fragile]{xargs: Usage and Options}
\begin{block}{Examples}
\begin{verbatim}
# Delete all .tmp files (safe with spaces)
find . -name "*.tmp" -print0 | xargs -0 rm
( run in 0.420 second using v1.01-cache-2.11-cpan-71847e10f99 )