Files
makronix/docs/guide/chapters/shell.xml
T
lotherk b654bf74a2 docs: add The Makronix Guide and its four installed forms
One DocBook source in docs/guide produces the manual pages, one HTML
file, the PDF and an MCDE information library.  The guide follows the
structure of The NetBSD Guide, describes Makronix 0.99.10
(Camouflage), and has its own chapters for MCDE, the Information
Manager and the display.

The forms are installed by the release:

  /usr/share/doc/makronix/makronix-guide.html
  /usr/share/doc/makronix/makronix-guide.pdf
  /usr/share/doc/makronix/infolib/makronix.dti/   (base-sys-share)
  /usr/share/man/man7/makronix-guide*.7           (man-reference-man)
  /etc/dt/config/Xsession.d/0000makronix          (etc-sys-etc)
  /etc/dt/infolib/en_US.UTF-8/makronix.dti        (symlink)

The information library is built with MCDE's dtdocbook2infolib from a
small Lua writer for the CDE DocBook SGML dialect; tools/test-tools.sh
runs docs/guide/check.sh on the installed copies and proves that a
missing manual page falls red.
2026-11-15 21:21:49 +00:00

119 lines
5.3 KiB
XML

<!-- License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. -->
<chapter id="shell">
<title>The Command Line</title>
<para>The desktop is where the work starts, but the command line is where
a Unix system is understood and repaired. Makronix uses NetBSD's shell,
NetBSD's tools and NetBSD's manual pages; nothing here is special to
Makronix except the paths of the MCDE programs.</para>
<sect1 id="shell-shell">
<title>The shell</title>
<para>The login shell of a new account is
<citerefentry><refentrytitle>sh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
NetBSD's POSIX shell. It reads <filename>~/.profile</filename> at login
and <filename>~/.shrc</filename> for interactive shells. A user who
prefers a Korn shell can use <filename>/usr/pkg/bin/ksh93</filename>
(installed for MCDE's <command>dtksh</command>) and change the login
shell with <citerefentry><refentrytitle>chsh</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
<para>The important environment variables are <envar>PATH</envar>,
<envar>HOME</envar>, <envar>SHELL</envar>, <envar>TERM</envar> and
<envar>LANG</envar>. A desktop session gets <envar>PATH</envar> from
the session configuration, not only from
<filename>~/.profile</filename>; if a program is found in a terminal but
not from the panel, compare the two:</para>
<screen>$ echo $PATH
$ env | sort</screen>
</sect1>
<sect1 id="shell-basics">
<title>Pipes, redirection and jobs</title>
<para>A pipe sends the output of one program to the input of the next;
redirection sends it to a file. The three that matter every day:</para>
<screen>$ dmesg | less
$ grep -i error /var/log/messages &gt; /tmp/errors
$ command 2&gt;&amp;1 | tee log</screen>
<para><literal>Ctrl</literal>+<literal>C</literal> stops the program in the
foreground, <literal>Ctrl</literal>+<literal>Z</literal> suspends it, and
<command>bg</command>, <command>fg</command> and
<command>jobs</command> manage it. <command>command &amp;</command>
starts it in the background.</para>
<para>A file's permissions are read with <command>ls -l</command> and
changed with <citerefentry><refentrytitle>chmod</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
The three digits are the owner, the group and everybody else; the
execute bit is what makes a file a program. A directory needs the
execute bit to be entered, and the write bit to be changed.</para>
<screen>$ chmod 644 notes.txt
$ chmod 755 script.sh
$ chown user:wheel script.sh</screen>
</sect1>
<sect1 id="shell-editing">
<title>Editing files</title>
<para><citerefentry><refentrytitle>vi</refentrytitle><manvolnum>1</manvolnum></citerefentry>
is in the base system and is the editor to know when the desktop is not
running. It has two modes: command mode, where keys are commands, and
insert mode, where they are text. <literal>i</literal> enters insert
mode, <literal>Esc</literal> returns to command mode,
<literal>:w</literal> writes, <literal>:q</literal> quits and
<literal>:wq</literal> does both. <literal>dd</literal> deletes a line,
<literal>/text</literal> searches, and <literal>u</literal> undoes.</para>
<para>On the desktop, <citerefentry><refentrytitle>dtpad</refentrytitle><manvolnum>1</manvolnum></citerefentry>
edits plain text with menus and a search dialog. Configuration files
are plain text either way; keep a copy before a large change
(<command>cp file file.orig</command>) and compare afterwards with
<citerefentry><refentrytitle>diff</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
</sect1>
<sect1 id="shell-man">
<title>Finding the documentation</title>
<para><citerefentry><refentrytitle>man</refentrytitle><manvolnum>1</manvolnum></citerefentry>
reads the manual pages. The sections are 1 (commands), 2 (system
calls), 3 (library functions), 4 (devices), 5 (file formats), 7
(conventions) and 8 (administration). The useful forms:</para>
<screen>$ man ls
$ man 5 rc.conf
$ man -k firewall
$ apropos password</screen>
<para><command>man -k</command> searches the one-line descriptions;
<command>apropos</command> is the same. The Makronix Guide is a set of
pages in section 7, starting at
<citerefentry><refentrytitle>makronix-guide</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
The HTML and PDF forms are under
<filename>/usr/share/doc/makronix</filename>.</para>
</sect1>
<sect1 id="shell-root">
<title>Becoming the administrator</title>
<para>Administrative commands run as <username>root</username>. On a
desktop, log in as yourself and use
<citerefentry><refentrytitle>su</refentrytitle><manvolnum>1</manvolnum></citerefentry>:</para>
<screen>$ su -
Password:
# </screen>
<para>The minus makes it a login shell, with root's
<envar>PATH</envar> and environment. Your account is in the wheel
group, which is what allows <command>su</command>; a terminal that is
left alone returns to your prompt when you type <command>exit</command>.
Log in as yourself rather than as root: the desktop account is the
account for people, and <command>su</command> is the door to the
system.</para>
</sect1>
</chapter>