Spring Semester 2004


Lab Notes One: Becoming familiar with Unix.

The purpose of this lab is to give you enough practice to be able to install Apache on your own.

Log in (to burrowww.cs.indiana.edu). Then start typing.

burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman
What does pwd do?
burrowww.cs.indiana.edu% ls -ld lab1
ls: lab1: No such file or directory
What does ls do?

Try

man ls
or
man pwd
now, while you read these notes.

What do the man pages tell about -ld used with ls?

burrowww.cs.indiana.edu% mkdir lab1
What does mkdir do?

Can you draw a picture of lab1?

burrowww.cs.indiana.edu% ls -ld lab1
drwxr-xr-x   2 dgerman  faculty       512 Jan 11 02:20 lab1
burrowww.cs.indiana.edu% cd lab1
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1
What does cd do?
burrowww.cs.indiana.edu% ls
burrowww.cs.indiana.edu% ls -l
total 0
burrowww.cs.indiana.edu% mkdir experiments
burrowww.cs.indiana.edu% ls
experiments
burrowww.cs.indiana.edu% ls -ld *
drwxr-xr-x   2 dgerman  faculty       512 Jan 11 02:21 experiments
burrowww.cs.indiana.edu% cd experiments
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1/experiments
Can you draw a picture of lab1?
burrowww.cs.indiana.edu% ls
burrowww.cs.indiana.edu% mkdir documents
burrowww.cs.indiana.edu% ls
documents
burrowww.cs.indiana.edu% ls -l
total 1
drwxr-xr-x   2 dgerman  faculty       512 Jan 11 02:22 documents
burrowww.cs.indiana.edu% mkdir programs
burrowww.cs.indiana.edu% cd documents
Can you draw a picture of lab1?
burrowww.cs.indiana.edu% emacs doc1.txt
What is emacs?

Note that in lab you can also use pico or vi instead.

burrowww.cs.indiana.edu% ls -l
total 1
-rw-r--r--   1 dgerman  faculty        42 Jan 11 02:23 doc1.txt
We have created a text file.
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1/experiments/documents
burrowww.cs.indiana.edu% cat doc1.txt
This is document 1. 
Not a long document. burrowww.cs.indiana.edu% pico doc2.txt
Before asking about pico: what is cat?

What is the IUB knowledge base?

Is there a introduction to Unix commands there?

What is cat?

burrowww.cs.indiana.edu% ls -l
total 2
-rw-r--r--   1 dgerman  faculty        42 Jan 11 02:23 doc1.txt
-rw-r--r--   1 dgerman  faculty        56 Jan 11 02:24 doc2.txt
burrowww.cs.indiana.edu% cat doc2.txt
This is another document.
Short as well, document #2. 

burrowww.cs.indiana.edu% cd ..
What is .. (dot-dot)?

How do you specify the parent directory of the current directory?

How do you specify the current directory?

burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1/experiments
burrowww.cs.indiana.edu% ls -l
total 2
drwxr-xr-x   2 dgerman  faculty       512 Jan 11 02:24 documents
drwxr-xr-x   2 dgerman  faculty       512 Jan 11 02:22 programs
burrowww.cs.indiana.edu% cd programs
burrowww.cs.indiana.edu% mkdir perl
burrowww.cs.indiana.edu% mkdir Java
burrowww.cs.indiana.edu% cd perl
Can you draw a picture of lab1 indicating your current directory?
burrowww.cs.indiana.edu% ls
burrowww.cs.indiana.edu% vi one
What is vi and how do you exit it?
burrowww.cs.indiana.edu% cat one
#!/usr/bin/perl

print "Hello, and welcome to Perl!\n"; 

burrowww.cs.indiana.edu% ls -l one
-rw-r--r--   1 dgerman  faculty        58 Jan 11 02:25 one
What's -rw-r--r-- and why do we care?

burrowww.cs.indiana.edu% ./one
./one: Permission denied
What's going on?
burrowww.cs.indiana.edu% chmod 700 one
What did we just do?

What difference will it make?

burrowww.cs.indiana.edu% ./one
Hello, and welcome to Perl!
What's the dot-slash (./) used for?
burrowww.cs.indiana.edu% pico One.java
burrowww.cs.indiana.edu% ls -l
total 2
-rw-r--r--   1 dgerman  faculty       108 Jan 11 02:26 One.java
-rwx------   1 dgerman  faculty        58 Jan 11 02:25 one
What have we just created?

Here's its contents:

class One {
  public static void main(String[] args) {
    System.out.println("Welcome to Java!"); 
  } 
}
What do we want to do with it?
burrowww.cs.indiana.edu% javac One.java
What have we done to it?

Have any new files been created?

Why?

burrowww.cs.indiana.edu% ls -l
total 3
-rw-r--r--   1 dgerman  faculty       416 Jan 11 02:26 One.class
-rw-r--r--   1 dgerman  faculty       108 Jan 11 02:26 One.java
-rwx------   1 dgerman  faculty        58 Jan 11 02:25 one
burrowww.cs.indiana.edu% java One
Welcome to Java!
What did we just do?
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1/experiments/programs/perl
burrowww.cs.indiana.edu% cd ..
burrowww.cs.indiana.edu% ls -l
total 2
drwxr-xr-x   2 dgerman  faculty       512 Jan 11 02:24 Java
drwxr-xr-x   2 dgerman  faculty       512 Jan 11 02:26 perl
burrowww.cs.indiana.edu% mv perl/One* Java
Why did we move these files?

Did we move any files?

Can you draw a picture of lab1 now and indicate your current directory?

burrowww.cs.indiana.edu% ls Java
One.class  One.java
Where is the perl program?
burrowww.cs.indiana.edu% ls perl
one
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1/experiments/programs
burrowww.cs.indiana.edu% cd ..
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1/experiments
burrowww.cs.indiana.edu% cd ..
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1
burrowww.cs.indiana.edu% ls -l
total 1
drwxr-xr-x   4 dgerman  faculty       512 Jan 11 02:22 experiments
Can you draw a picture of lab1 now and indicate your current directory?

burrowww.cs.indiana.edu% du -a experiments
1	experiments/documents/doc2.txt
1	experiments/documents/doc1.txt
3	experiments/documents
1	experiments/programs/perl/one
2	experiments/programs/perl
1	experiments/programs/Java/One.class
1	experiments/programs/Java/One.java
3	experiments/programs/Java
6	experiments/programs
10	experiments
What does du do?
burrowww.cs.indiana.edu% man du
Reformatting page.  Wait... done

Maintenance Commands                                       du(1M)

NAME
     du - summarize disk usage

SYNOPSIS
     /usr/bin/du  [ -adkr ]  [-s  | -o ]  [ file ... ]

     /usr/xpg4/bin/du  [-a  | -s ]  [ -krx ]  [ file ... ]

DESCRIPTION
     The du  utility writes to standard output the  size  of  the
     file  space  allocated  to,  and  the size of the file space
     allocated to each subdirectory of, the file hierarchy rooted
     in  each  of the specified files. The size of the file space
     allocated to a file of type directory is defined as the  sum
     total  of space allocated to all files in the file hierarchy
     rooted in the directory plus  the  space  allocated  to  the
     directory itself.

     Files with multiple links will be counted  and  written  for
[--More--(13%)]
burrowww.cs.indiana.edu% pwd
/nfs/paca/home/user1/dgerman/lab1
What does tar do?
burrowww.cs.indiana.edu% tar cvf whoa.tar experiments
Explain the colors and the output.
experiments/
experiments/documents/
experiments/documents/doc2.txt
experiments/documents/doc1.txt
experiments/programs/
experiments/programs/perl/
experiments/programs/perl/one
experiments/programs/Java/
experiments/programs/Java/One.class
experiments/programs/Java/One.java
burrowww.cs.indiana.edu% ls -l
total 11
drwxr-xr-x   4 dgerman  faculty       512 Jan 11 02:22 experiments
-rw-r--r--   1 dgerman  faculty     10240 Jan 11 02:30 whoa.tar
What's gzip?

What's gunzip?

burrowww.cs.indiana.edu% gzip whoa.tar
burrowww.cs.indiana.edu% ls -l
total 2
drwxr-xr-x   4 dgerman  faculty       512 Jan 11 02:22 experiments
-rw-r--r--   1 dgerman  faculty       821 Jan 11 02:30 whoa.tar.gz
What happened?
burrowww.cs.indiana.edu% rm -ir experiments
rm: descend into directory `experiments'? y
rm: descend into directory `experiments/documents'? y
rm: remove `experiments/documents/doc2.txt'? y
rm: remove `experiments/documents/doc1.txt'? y
rm: remove directory `experiments/documents'? y
rm: descend into directory `experiments/programs'? y
rm: descend into directory `experiments/programs/perl'? y
rm: remove `experiments/programs/perl/one'? y
rm: remove directory `experiments/programs/perl'? y
rm: descend into directory `experiments/programs/Java'? y
rm: remove `experiments/programs/Java/One.class'? y
rm: remove `experiments/programs/Java/One.java'? y
rm: remove directory `experiments/programs/Java'? y
rm: remove directory `experiments/programs'? y
rm: remove directory `experiments'? y
What did we just do?

Can you draw a picture of lab1 now and indicate your current directory?

burrowww.cs.indiana.edu% ls -l
total 1
-rw-r--r--   1 dgerman  faculty       821 Jan 11 02:30 whoa.tar.gz
What's gunzip doing?
burrowww.cs.indiana.edu% gunzip whoa.tar.gz
burrowww.cs.indiana.edu% ls -l
total 10
-rw-r--r--   1 dgerman  faculty     10240 Jan 11 02:30 whoa.tar
Now, what did we do?
burrowww.cs.indiana.edu% tar xvf whoa.tar
experiments/
experiments/documents/
experiments/documents/doc2.txt
experiments/documents/doc1.txt
experiments/programs/
experiments/programs/perl/
experiments/programs/perl/one
experiments/programs/Java/
experiments/programs/Java/One.class
experiments/programs/Java/One.java
Can you draw a picture of lab1 now and indicate your current directory?

burrowww.cs.indiana.edu% ls -ld *
drwxr-xr-x   4 dgerman  faculty       512 Jan 11 02:22 experiments
-rw-r--r--   1 dgerman  faculty     10240 Jan 11 02:30 whoa.tar
burrowww.cs.indiana.edu% du -a experiments
1	experiments/documents/doc2.txt
1	experiments/documents/doc1.txt
3	experiments/documents
1	experiments/programs/perl/one
2	experiments/programs/perl
1	experiments/programs/Java/One.class
1	experiments/programs/Java/One.java
3	experiments/programs/Java
6	experiments/programs
10	experiments
burrowww.cs.indiana.edu% cd experiments
Can you draw a picture of lab1 now and indicate your current directory?

burrowww.cs.indiana.edu% cat documents/*
This is document 1. 
Not a long document. This is another document.
Short as well, document #2. 

burrowww.cs.indiana.edu%
Now you're ready to install Apache.

Before you do that here's your:

A348/A548 LAB ASSIGNMENT ONE

  1. Create a public directory in your home directory.

  2. Make sure it is readable by everybody (chmod 755).

  3. Work through this lab and create the whoa.tar.gz file. (The doc1.txt and doc2.txt files should contain text that describes you and your interests. For example write about you in doc1.txt and about your expectations for this class in doc2.txt).

  4. Then place this archive in your public directory.

  5. We'll retrieve it and uncompress, unarchive, and grade it from there.
For graduate students: add a few HTML files to the hierarchy.

This lab assignment is due next lab, in class.


Last updated on Jan 15, 2004, by Adrian German for A348/A548