1.1 Unix and Linux: Applications
1.1 Unix and Linux: Applications
1.1 Unix and Linux: Applications
CH#1:Introduction
applications
programs
X shell
kernel
hardware
1.17 Exercises
1. a. Log in.
b. Log out.
c. Log in again. Open a terminal window, to start a shell.
d. Exit from the shell; the terminal window will close.
e. Start another shell. Enter each of the following commands in turn.
■ date
■ whoami
■ hostname
■ uname
■ uptime
2. a. Use the ls command to see if you have any files.
b. Create a new file using the cat command as follows:
$ cat > hello.txt
Hello world!
This is a text file.
Press Enter at the end of the last line, then Ctrl+D to denote the end of the file.
c. Use ls again to verify that the new file exists.
d. Display the contents of the file.
e. Display the file again, but use the cursor keys to execute the same command again without having to
retype it.
3. a. Create a second file. Call it secret-of-the-universe, and put in whatever content you deem appropriate.
b. Check its creation with ls.
c. Display the contents of this file. Minimise the typing needed to do this:
■ Scroll back through the command history to the command you used to create the file.
■ Change that command to display secret-of-the-universe instead of creating it.
4. After each of the following steps, use ls and cat to verify what has happened.
a. Copy secret-of-the-universe to a new file called answer.txt. Use Tab to avoid typing the existing file’s
name in full.
b. Now copy hello.txt to answer.txt. What’s happened now?
c. Delete the original file, hello.txt.
d. Rename answer.txt to message.
e. Try asking rm to delete a file called missing. What happens?
f. Try copying secret-of-the-universe again, but don’t specify a filename to which to copy. What happens
now?