<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Learn Unix on Unix Handbook</title><link>https://www.unixhandbook.com/learn/</link><description>Recent content in Learn Unix on Unix Handbook</description><generator>Hugo</generator><language>en-US</language><atom:link href="https://www.unixhandbook.com/learn/index.xml" rel="self" type="application/rss+xml"/><item><title>A first shell session</title><link>https://www.unixhandbook.com/learn/first-shell/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.unixhandbook.com/learn/first-shell/</guid><description>&lt;h2 id="synopsis"&gt;Synopsis&lt;a class="anchor" href="#synopsis" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A terminal can display a login request, a shell waiting for a command, or a program already running. Recognize each state, enter a command, and return to the shell. The exercises require an ordinary account on OpenBSD or Debian GNU/Linux. Obtain the account name and access details from the person who manages the machine.&lt;/p&gt;&#10;&lt;h2 id="recognize-the-prompt"&gt;Recognize the prompt&lt;a class="anchor" href="#recognize-the-prompt" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;At a text console displaying &lt;code&gt;login:&lt;/code&gt;, type the account name and press Enter. At the password prompt, type the password and press Enter. The terminal normally displays nothing during password entry, including asterisks. After a successful login, a program called the &lt;em&gt;shell&lt;/em&gt; prints its prompt and waits.&lt;/p&gt;</description></item><item><title>Files, paths, and directories</title><link>https://www.unixhandbook.com/learn/files-and-paths/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.unixhandbook.com/learn/files-and-paths/</guid><description>&lt;h2 id="synopsis"&gt;Synopsis&lt;a class="anchor" href="#synopsis" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Keep the course files in a directory named &lt;code&gt;unix-practice&lt;/code&gt; under the account&amp;rsquo;s home directory. Use an ordinary account and the &lt;code&gt;/bin/sh&lt;/code&gt; session from &lt;a href="https://www.unixhandbook.com/learn/first-shell/"&gt;A first shell session&lt;/a&gt;. The following exercises use the names &lt;code&gt;notes&lt;/code&gt; and &lt;code&gt;copies&lt;/code&gt; inside the practice directory.&lt;/p&gt;&#10;&lt;h2 id="make-a-place-to-work"&gt;Make a place to work&lt;a class="anchor" href="#make-a-place-to-work" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Create the practice directory.&lt;/p&gt;&#10;&lt;div class="command-block"&gt;&#10; &lt;div class="command-tools"&gt;&lt;span&gt;Shell input&lt;/span&gt;&lt;button type="button" class="copy-command" hidden&gt;Copy&lt;/button&gt;&lt;span class="copy-status" role="status"&gt;&lt;/span&gt;&lt;/div&gt;&#10; &lt;pre&gt;&lt;code&gt;mkdir &amp;#34;$HOME/unix-practice&amp;#34;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;/div&gt;&lt;p&gt;A successful &lt;code&gt;mkdir&lt;/code&gt; normally prints nothing. If the directory already exists from an earlier lesson, keep it. If the name belongs to unrelated work, use a fresh practice account. Enter the directory and check the resulting path.&lt;/p&gt;</description></item><item><title>Read, edit, and find text</title><link>https://www.unixhandbook.com/learn/editing-text/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.unixhandbook.com/learn/editing-text/</guid><description>&lt;h2 id="synopsis"&gt;Synopsis&lt;a class="anchor" href="#synopsis" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Save two lines in a text file, search them, and find the file from its parent directory. Use the practice directory from &lt;a href="https://www.unixhandbook.com/learn/files-and-paths/"&gt;Files, paths, and directories&lt;/a&gt; and an ordinary account with the &lt;code&gt;vi&lt;/code&gt; editor and the &lt;code&gt;more&lt;/code&gt; viewer installed.&lt;/p&gt;&#10;&lt;h2 id="open-a-field-note"&gt;Open a field note&lt;a class="anchor" href="#open-a-field-note" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Enter the practice directory and check the destination.&lt;/p&gt;&#10;&lt;div class="command-block"&gt;&#10; &lt;div class="command-tools"&gt;&lt;span&gt;Shell input&lt;/span&gt;&lt;button type="button" class="copy-command" hidden&gt;Copy&lt;/button&gt;&lt;span class="copy-status" role="status"&gt;&lt;/span&gt;&lt;/div&gt;&#10; &lt;pre&gt;&lt;code&gt;cd &amp;#34;$HOME/unix-practice&amp;#34;&#10;pwd&#10;ls notes&lt;/code&gt;&lt;/pre&gt;&#10;&lt;/div&gt;&lt;p&gt;Use &lt;code&gt;notes/meadow-log.txt&lt;/code&gt; for a new practice note. If that name already contains a previous exercise, inspect the file before modifying it. Start the editor.&lt;/p&gt;</description></item><item><title>Users, groups, and permissions</title><link>https://www.unixhandbook.com/learn/permissions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.unixhandbook.com/learn/permissions/</guid><description>&lt;h2 id="synopsis"&gt;Synopsis&lt;a class="anchor" href="#synopsis" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A readable file can be inaccessible through its directory. Create a small example under the account&amp;rsquo;s home directory, predict the result of an access change, and restore the original settings. Run the exercise as an ordinary user, since the root account can bypass many permission checks.&lt;/p&gt;&#10;&lt;h2 id="identify-the-account-and-the-file"&gt;Identify the account and the file&lt;a class="anchor" href="#identify-the-account-and-the-file" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Return to the &lt;a href="https://www.unixhandbook.com/learn/files-and-paths/"&gt;practice directory&lt;/a&gt; and identify the account.&lt;/p&gt;&#10;&lt;div class="command-block"&gt;&#10; &lt;div class="command-tools"&gt;&lt;span&gt;Shell input&lt;/span&gt;&lt;button type="button" class="copy-command" hidden&gt;Copy&lt;/button&gt;&lt;span class="copy-status" role="status"&gt;&lt;/span&gt;&lt;/div&gt;&#10; &lt;pre&gt;&lt;code&gt;cd &amp;#34;$HOME/unix-practice&amp;#34;&#10;pwd&#10;id&lt;/code&gt;&lt;/pre&gt;&#10;&lt;/div&gt;&lt;p&gt;The output from &lt;code&gt;id&lt;/code&gt; identifies the current user, the primary group, and group memberships. Check that the working directory ends in &lt;code&gt;/unix-practice&lt;/code&gt;. Create a directory reserved for this exercise.&lt;/p&gt;</description></item><item><title>Streams, redirection, and filters</title><link>https://www.unixhandbook.com/learn/streams-and-filters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.unixhandbook.com/learn/streams-and-filters/</guid><description>&lt;h2 id="synopsis"&gt;Synopsis&lt;a class="anchor" href="#synopsis" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Turn three field observations into a count for each species. Run the commands in &lt;code&gt;/bin/sh&lt;/code&gt; under an ordinary account. The exercise needs a writable practice directory and three lines of text. Both the input and the expected result appear below.&lt;/p&gt;&#10;&lt;h2 id="prepare-the-observations"&gt;Prepare the observations&lt;a class="anchor" href="#prepare-the-observations" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Use the practice directory under the home directory. These commands also create it for a first visit to this chapter.&lt;/p&gt;&#10;&lt;div class="command-block"&gt;&#10; &lt;div class="command-tools"&gt;&lt;span&gt;Shell input&lt;/span&gt;&lt;button type="button" class="copy-command" hidden&gt;Copy&lt;/button&gt;&lt;span class="copy-status" role="status"&gt;&lt;/span&gt;&lt;/div&gt;&#10; &lt;pre&gt;&lt;code&gt;mkdir -p &amp;#34;$HOME/unix-practice&amp;#34;&#10;cd &amp;#34;$HOME/unix-practice&amp;#34;&#10;pwd&lt;/code&gt;&lt;/pre&gt;&#10;&lt;/div&gt;&lt;p&gt;Check that the path ends in &lt;code&gt;/unix-practice&lt;/code&gt;. Save &lt;a href="observations.txt"&gt;observations.txt&lt;/a&gt; there. At a text console, the following command creates the same file. It replaces &lt;code&gt;observations.txt&lt;/code&gt; if that name already exists, so use it only for the practice copy.&lt;/p&gt;</description></item><item><title>Processes, jobs, and signals</title><link>https://www.unixhandbook.com/learn/processes-and-jobs/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.unixhandbook.com/learn/processes-and-jobs/</guid><description>&lt;h2 id="synopsis"&gt;Synopsis&lt;a class="anchor" href="#synopsis" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Start a harmless waiting program in a terminal, locate it, and control its execution from the same shell. Use an interactive &lt;code&gt;/bin/sh&lt;/code&gt; session under an ordinary account on OpenBSD or Debian. Start a fresh practice shell if other jobs are already running there.&lt;/p&gt;&#10;&lt;h2 id="start-work-in-the-background"&gt;Start work in the background&lt;a class="anchor" href="#start-work-in-the-background" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;em&gt;process&lt;/em&gt; is a running instance of a program. The operating system assigns it a process ID (PID). A shell &lt;em&gt;job&lt;/em&gt; is a command or pipeline the interactive shell tracks as a unit. One job can contain several processes.&lt;/p&gt;</description></item><item><title>Turn a pipeline into a shell script</title><link>https://www.unixhandbook.com/learn/shell-script/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.unixhandbook.com/learn/shell-script/</guid><description>&lt;h2 id="synopsis"&gt;Synopsis&lt;a class="anchor" href="#synopsis" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Make the frequency report reusable. Pass filenames to a script as arguments, produce one labeled report per file, and signal a failure if an input is missing. Use an ordinary account and the &lt;a href="https://www.unixhandbook.com/learn/streams-and-filters/observations.txt"&gt;observations file&lt;/a&gt; from &lt;a href="https://www.unixhandbook.com/learn/streams-and-filters/"&gt;Streams, redirection, and filters&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="put-one-command-in-a-file"&gt;Put one command in a file&lt;a class="anchor" href="#put-one-command-in-a-file" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Return to the practice directory. Confirm the location and input before continuing.&lt;/p&gt;&#10;&lt;div class="command-block"&gt;&#10; &lt;div class="command-tools"&gt;&lt;span&gt;Shell input&lt;/span&gt;&lt;button type="button" class="copy-command" hidden&gt;Copy&lt;/button&gt;&lt;span class="copy-status" role="status"&gt;&lt;/span&gt;&lt;/div&gt;&#10; &lt;pre&gt;&lt;code&gt;cd &amp;#34;$HOME/unix-practice&amp;#34;&#10;pwd&#10;ls observations.txt&lt;/code&gt;&lt;/pre&gt;&#10;&lt;/div&gt;&lt;p&gt;The shell accepts commands from a text file as well as from a terminal. Save the familiar pipeline in a disposable file. The redirection replaces &lt;code&gt;one-report.sh&lt;/code&gt; in the practice directory.&lt;/p&gt;</description></item><item><title>Build and install a small program</title><link>https://www.unixhandbook.com/learn/build-a-program/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://www.unixhandbook.com/learn/build-a-program/</guid><description>&lt;h2 id="synopsis"&gt;Synopsis&lt;a class="anchor" href="#synopsis" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Build a command named &lt;code&gt;count-observations&lt;/code&gt; to count sightings in the &lt;a href="https://www.unixhandbook.com/learn/streams-and-filters/observations.txt"&gt;observations file&lt;/a&gt;. Each nonempty line counts as one sighting. The build requires a C compiler, the C library development files, and &lt;code&gt;make&lt;/code&gt;. Installation takes place under the ordinary account&amp;rsquo;s home directory.&lt;/p&gt;&#10;&lt;h2 id="check-the-tools-and-prepare-the-source"&gt;Check the tools and prepare the source&lt;a class="anchor" href="#check-the-tools-and-prepare-the-source" aria-label="Link"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Check whether the shell can locate the compiler driver and the build tool.&lt;/p&gt;&#10;&lt;div class="command-block"&gt;&#10; &lt;div class="command-tools"&gt;&lt;span&gt;Shell input&lt;/span&gt;&lt;button type="button" class="copy-command" hidden&gt;Copy&lt;/button&gt;&lt;span class="copy-status" role="status"&gt;&lt;/span&gt;&lt;/div&gt;&#10; &lt;pre&gt;&lt;code&gt;command -v cc&#10;command -v make&lt;/code&gt;&lt;/pre&gt;&#10;&lt;/div&gt;&lt;p&gt;Each command should print a name or path. If either is missing, arrange for the development tools to be installed before proceeding. On OpenBSD, the &lt;code&gt;comp&lt;/code&gt; installation set includes the compiler collection, headers, and libraries. On Debian GNU/Linux 13, the &lt;code&gt;build-essential&lt;/code&gt; package depends on the compiler, C development headers, and &lt;code&gt;make&lt;/code&gt;. A missing &lt;code&gt;stdio.h&lt;/code&gt; during compilation also indicates that the development environment needs attention. &lt;a href="https://www.openbsd.org/faq/faq4.html"&gt;OpenBSD installation sets&lt;/a&gt; · &lt;a href="https://packages.debian.org/trixie/build-essential"&gt;Debian build-essential&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>