Synopsis
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.
Recognize the prompt
At a text console displaying login:, 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 shell prints its prompt and waits.
Opening a terminal window from a desktop normally starts a shell under the existing account. A prompt may contain an account name, a machine name, a directory, or just a punctuation mark. At a shell prompt, enter the following command and press Enter.
pwdThe shell runs pwd, which prints the path to its current working directory. The prompt then appears again. A path beginning with / starts at the root of the directory tree. The terminal displays the characters. The shell interprets the command. Copy only the command from a shell example. The command examples in the style guide distinguish input, output, and transcripts.
Check the numeric account identifier.
id -uAn ordinary account has a nonzero identifier. Zero identifies the root account, which can change the system. If the result is zero, return to the login screen and use an ordinary account for the course.
Start the practice shell
Shells accept different command languages. OpenBSD and Debian both provide a shell at /bin/sh that accepts the examples in this course. Start it in the same terminal.
/bin/shA new prompt marks the beginning of the practice shell. Its appearance may be identical to the previous prompt. The original shell waits until the practice shell exits. OpenBSD sh(1) · Debian sh(1)
Return to the home directory and print its path.
cd
pwdWith no argument, cd changes the working directory to the account’s home. On success, cd usually prints nothing. The next line comes from pwd. Compare it with the home directory recorded in the shell variable HOME.
printf '%s\n' "$HOME"The shell replaces "$HOME" with the value of the variable. The double quotes keep the path together even if it contains a space. The format %s\n tells printf to print a string followed by a newline.
Interrupt a running program
Start a command that waits for one minute.
sleep 60The terminal remains quiet and the prompt disappears while the shell waits. Hold Ctrl and press C once. The terminal normally sends an interrupt signal to the foreground program. Here, sleep ends and the shell prints its prompt. The terminal may display ^C at the point of interruption.
Open and leave a manual page
Press q to leave the page viewer when it is open. Display the manual for ls, the command that lists directory entries.
MANPAGER=more PAGER=more man lsThe two assignments select the more page viewer for this command on the teaching systems. The first screen identifies the command and shows its usage. Press the space bar to advance a screen. Press q to return to the shell. A minimal installation may lack the manual collection or its viewer. The release manual supplies the same reference online. OpenBSD ls(1) · Debian ls(1)
Continue in the practice shell for Files, paths, and directories. When pausing the course, type exit and press Enter to leave the practice shell. At the next session, enter /bin/sh again.