UNIX BASICS
CS 3000 -- Lab Assignment #1 (For Unix Beginners)
Read this material. Do the exercises here that you don't
understand completely. Work with a partner
- Password Check:
- login to one of the Sun Ultra's
- If you don't have an appropriate password, change it. (Use the
nispasswd command.)
- If you changed your password, log out and then log back in to
make sure your new password works the way you think it
should.
- Do the command:
man ls
Read the DESCRIPTION section, and look at some of the options
such as -l, -a, -F, and -C. Leave
the information on-screen
- File Copy Exercise:
- Open a new terminal window and do
ls ~john
This lists the contents of my home directory. Remember that the
tilde (~) is a special symbol that means "home directory
of." If you know a person's user name, you can use this notation to
access his or her home directory, even though you may not know the
path to the directory. (However it doesn't work if you have not been
granted the required permissions on the directory.)
- Do
ls -l ~john
(That's an "el up there after the hyphen," not a "one.") Look at
the information that is written when you run the command. Using
the output of
man ls
in the other window for help, figure out the meaning of each
column of the output of
ls -l ~john
If you find you are "spinning your wheels" ask some
questions.
Next, find a directory below ~john with permisions that allow you
to cd to it.
- Do a cd to the directory you found.
- Use cd and ls commands to look around and see
the names of some of the files and directories there. (Ask for
help if you get stuck.)
- Go back (if necessary) to that first directory you found inside
~john and execute this command:
ls -lR | less
What happens? What does the -R option to the ls command
do?
- Look for an ascii file (a plain text file). You can check the
files in a directory by cd'ing to the directory and running the
command:
file *
If you don't find an ascii file where you are, try moving into a
different directory.
- Do
cp filename ~/
where filename stands for the name of the ascii file you
found. This command copies the file into your home directory.
- Do
cd ~
or just
cd
(This puts you back into your home directory)
- Making a Directory and Moving a File:
- Do an ls on your home directory
- Do an ls -al on your home directory
- Do mkdir CS3000
- Do another ls -al and look at the permissions on the
directory you just created
- The file that you copied from my directory to your home directory:
Move it into your new CS3000 directory using the mv command
- "One more time" -- Put a copy of a different file from my home
directory into your CS3000 directory.
- Reading a File:
- Take a look at a file using more -- Do
more filename
- Take a look at a file using less
- Take a look at a file using cat
- Take a look at a file using cat, piping the file through
more
- Using the rm Command
- Do a man on the rm command. Read the
DESCRIPTION section and several of the descriptions of
options.
- Remove one of the files you previously put into your CS3000
directory.
- Using the pwd Command
- Do a pwd (this tells you the current working directory)
- Do a cd to your home directory
- Do a pwd again
- Remove the other file you copied to your CS3000 directory, unless
you want to hold on to it for a while.