this exercise
is slightly modified from http://www.upscale.utoronto.ca/GeneralInterest/Harrison/LearnLinux/Module1.html
Exercise 1
- Log in
- Use the ls
command to see if you have any files
- Log out
- Log in again
- Create a new file by doing one or more of the
following:
[you@faraday pwd]$ cat > hello.txt
Hello world!
This is a text file.
^d
[you@faraday pwd]$
_
|
- Press Enter at the end of the last line, then Ctrl+D (^d) to denote the end of the file.
-
- Use vi. to create a file.
[you@faraday pwd]$ vi hello.txt
|
- type vi hello2.txt
- type i
to get into insert mode
- type words inside your file
- press escape to return to
command mode
- type :wq
and enter to write and quit
- Use the ed editor to create
the text:
- type ed
hello3.txt
- type a and enter to add lines
- type words inside your file
Hello world!
This is a text file.
- type . and enter to end the add mode
- type w and
enter to save
- type q and enter to exit
-
- Use ls to see that
the file exists.
- Display the contents of the file.
- Display the file again, but use the cursor keys to
execute the same command again without having to retype it.


Exercise 2
- Create a second file. Call it secret-of-the-universe,
and put in it whatever content you deem appropriate.
- Check that the contents of the file
is ASCII text using the file command.
- 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.


Exercise 3
- Copy secret-of-the-universe to a new file called answer.txt. Use Tab to avoid typing the existing file’s name in full.
- Now copy hello.txt to answer.txt. What’s happened now?
- Delete the original file, hello.txt.
- Rename answer.txt to message.
- Try asking rm
to delete a file called missing. What happens?
- Try copying secret-of-the-universe again, but don’t specify a filename to which to copy.
What happens now?