Name:
Full E-mail Address:
UNIX System Used:
1. (a) What will the following command line output to your terminal screen?
$ echo Computer System Unix Command
(b) If there is output, why is it produced in this way? If none, why?
(c) Write a command line, using echo, to output to your terminal screen
the following:
Computer System Unix Command
(d) What will each of the following command lines output to your terminal
screen?
$ printf +3x -4y = +5z
$ printf -3x +4y = -5z
(e) If there is output, why is it produced in this way ? If none, why ?
(f) How can you modify the printf statement(s) to produce the exact
equation indicated in its arguments.
2. (a) What are the differences and similarities between the cat and ls
utilities?
(b) What are the differences and similarities between the printf
and less utilities?
(c) Explain the differences between the following two commands:
$ echo cat
$ cat echo
3. (a) What happens when you do the following?
$ cp /dev/null a
$ cp /dev/null b
$ cp /dev/null c
(b) If any files are created, what are their content sizes?
(c) What happens if you do the following?
$ cp a b z
(d) What happens if you do the following?
$ cp b z
(e) What happens if you give the following commands below when the
file called d already exists, or doesn't exist? Analyze all
possibilities for f.
$ cp f d
$ mv f d
(f) What happens if d is a directory name? Analyze all possibilities
for f.
$ cp f d
$ mv f d
4. (a) Which of the following 10 expressions are legal filenames on your Unix
System?
(b) Which of these are legal pathnames on your Unix System?
(1) .bash_profile (4) //red///dragon (7) */? (10) .././../
(2) "red dragon" (5) /red/dragon (8) red/dragon
(3) dragon (6) ?red* (9) red#@().dragon
5. (a) Under what conditions does the path vi and the path /bin/vi
refer to the same file?
(b) Give three commands that you can use to list the absolute pathname
of your home directory.
6. Create a directory and make it your current directory. Then issue the
following commands:
$ > x.html
$ > y.html
$ > z.html
(a) When you execute ls on the command line, you should get three
filenames output from left to right on one line. How can you run the
ls command and get one filename per line output.
(b) What happens (and why does it happen) when you then type:
$ mv *.html *.xml
Now do the following:
$ rm *.html
$ > z.html
(c) What happens (and why does it happen) when you then type:
$ mv *.html *.xml
7. Send exactly the following as an Email message from your Linux
account to the userid: newkatz@ned.highline.edu
Make sure to replace the enclosed { } with your own information.
Subject: You've Got Mail!
This answers question 7 of Assignment 1.
{Your Name}
{Your E-mail address}
8. (a) Can Standard Output and Standard Error be the same file? Explain.
(b) Can Standard Output and Standard Input be the same file? Explain.
(c) How can you use the head and tail utilities together to display
just the 12th line of a given file?
(d) How can you look at the first E-mail message someone sent you,
without running the mail utility?
9. What happens and why does it happen when you issue the following
commands?
(a) $ date > date
(b) $ date < date
(c) $ cat < date > nodate
(d) $ cat date < $HOME/.bashrc
10. If you have a file that contains the following paragraph being edited
by vi (vim) and the cursor is located on the last comma (,), how
can you, by specifying vi (vim) commands to navigate and edit:
(a) move the cursor to the beginning of the phrase Unit of Measure?
(b) then move the cursor to the beginning of the word letters and
change that word to: characters
(c) then change all the words that have initial capital letters to
lower case except those that start a sentence?
The vi editor has a command, tilde (~),
that changes lowercase letters to
uppercase and vice versa.
Unfortunately the ~ command does not
work with a Unit of Measure or
a Repeat Factor, so you have to change
the case one character at a time.
Questions about the questions? Robert Katz: rkatz@ned.highline.edu
Last Update June 23, 2003