Note: The exercises here are meant for Linux and macOS. That doesn't mean that they cannot be executed in a Windows operating system but it might require some adaptation of the syntax.
Running a terminal
Exercise 1: Answer
By examining the menu items for your terminal program, figure out how to create a new tab.
Run a new terminal: (ctrl/command) + alt + t
Create a new tab: (ctrl/command) + t
Our First Command
Exercise 1: Answer
Write a command that prints out the string “hello, world”. Extra credit: do it two different ways, both with and without using quotation marks.
echo "hello, world"
echo hello, world
Exercise 2: Answer
Type the command echo 'hello (with a mismatched single quote), and then get out of trouble using the terminate shortcut, either CTRL+C or COMMAND+C depending on the operating system.
echo 'hello
(ctrl/command) + c
Man pages
Exercise 1: Answer
According to the man page, what is the official description of echo on your system?
display a line of text
Exercise 2: Answer
By reading the man page for echo, determine the command needed to print out “hello” without the trailing newline, and verify using your terminal that it works as expected.
echo -n [text]
Editing the line
Exercise 1: Answer
Using the up arrow, print to the screen the strings “fee”, “fie”, “foe”, and “fum” without retyping echo each time.
echo "fee"
press up-arrow, replace "fee" with "fie" and so on
Exercise 2: Answer
Use any combination of Ctrl-A, Ctrl-E, arrow keys, or Option-click to change the occurrences of the short s to the archaic long s “ſ”.
ctrl-A
ctrl-E
arrow keys to navigate and edit
Cleaning up
Summary
Exercise 1: Answer
Write a command to print the string Use "man echo", including the quotes; i.e., take care not to print out Use man echo instead.
echo 'Use "man echo"'
Exercise 2: Answer
By running man sleep, figure out how to make the terminal “sleep” for 5 seconds, and execute the command to do so. After waiting the requisite 5 seconds, execute the command to sleep for 5000 seconds, realise that’s well over an hour, and then use the instructions from Box 4 to get out of trouble.
sleep 5s
sleep 5000s
ctrl-c or Esc