squeak!
Syllabus Homepage
Course Overview
Course resources
Day 1
Day 2
Day 3
Day 4
Common errors
Internet Glossary
About Your Instructor
Credits: This site powered by the vi text editor, apache webserver, perl scripting, and Debian linux.
squeak!
find your feet: pwd, ls -l.
man [topic] is your friend.

Intro to Unix - Day 3

Goals

In this session you will:
  • wildcards
  • control jobs
  • advanced manpages
  • change passwords
  • change users
  • change groups
  • reassign user and group ownership
  • symlinks

POST

  1. log into your box
  2. start a terminal
  3. load the bash shell so you can leverage filename completion and command history
  4. where are you?
  5. who are you?
  6. make a directory under your home directory called temp
  7. in your temp directory make a file called editing.txt. Write a short note (a couple of sentences) about what you plan to do with your weekend. Close the file.
  8. which user owns the file? which group?
  9. who else is likely in that group?
  10. what are the permissions on this file? For the user? group? others on the system?
  11. change the permissions on the file so that even you cannot write to it. Verify that you have set the perms correctly.
  12. edit your file again, and make a small change to it. Save your work. (aha!) Close the file.
  13. change the permissions so that you can change the file. Reload the file and edit it to make the change you attempted in the previous step.
  14. make a copy of editing.txt called .plan
  15. move .plan to your home directory
  16. finger your username (or the username of your neighbors)
  17. remove your temp directory.

filename wildcard

The most common wildcard is the * (asterisk, star). It matches any legal filename characters.

  • ls *.txt list all files that end with .txt
  • ls .*txt list all files that start with . (note you may have to use the -a switch)
You may be able to work with nonstandard filenames by trapping the filename in quotes: "my file.txt". This may confuse some applications, though.

job control

  • business as usual; the foreground (sleep)
  • suspension ctrl-z
  • using the background bg(hotjava)
  • bringing something to the foreground fg
  • escaping a hung terminal (garbage)
    1. ctrl-c
    2. reset
    3. stty sane
    4. ctrl-j
  • redirecting output to the null device (/dev/null and its interesting side effects with cat)

more manpage magic

If you don't know the name of the tool you want to look up, you can frequently use the manpage's search function to show you related manpages:
  • apropos keyword
  • man -k keyword

changing passwords

passwd Remember to change it back!

changing user

  • log out and back in
  • su

change groups

  • groups shows you what groups you are in now.
  • newgrp groupname will change your current group
  • newgrp with no groupname will reset you to your default group

reassign user and group ownership

  • chown username target
  • chgrp groupname target
  • chown username.groupname target
  • the -R switch for recursion (also useful for chmod)

symlinks

You will frequently make symbolic links to "alias" a file or directory.

ln -s original path link path

note what a link looks like in an ls -l listing

helpful hints

  • common errors list above
  • deja/google

Final Exam

  • Section 1
    1. find a utility that tells you the system's uptime (amount of time since the last reboot).
    2. how long has your box been up? _________________
  • Section 2
    1. how can you find out what shells are available to you? (you may be able to use grep or a wildcard to your advantage here)
    2. name two more shells that are available on your system _______ ________
    3. pick one and load it to see what it looks like
    4. how can you find out the features of
    5. back out of that shell (you should be back in bash)
    6. remove all content from your .plan file
  • Section 3
    1. in your home directory, make a file called pets.txt that contains the names of your pets[s]. If you don't have any, make up something like a pet giraffe or jumping bean.
    2. make a symbolic link to pets.txt called link.txt
    3. edit link.txt to add another animal you wish you had.
    4. what has happened to pets.txt? Why?

Onward and upward

  • request a practice account on an existing unix box
  • Install your own unix box on an old 486+; dual boot if you must.
  • Intermediate Unix (Unix II)
  • shell scripting
  • perl
  • c
  • unix system administration
  • apache administration


http://www.mousetrap.net
$Id: day3.orb,v 1.10 2002/01/24 23:35:48 mouse Exp $


© 1994-2002 jason carr.
distributed under the terms of the GNU Free Documentation License.

jason carr

Reminders

  • Classroom temperature can be wildly variable. Dress lightly and bring layers.
  • your username is based on the class title and the last two digits of your workstation's hostname.
  • remember to take your work with you.