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.

Introduction to Unix - Day 1

Admin

Texas state survey and Roll.

Goals: Finding your sea legs

In this session you will:
  • learn what unix is and isn't
  • learn how unix is used today
  • learn how unix is different
  • get a feel for where you are, what is around you, and what you can do

What is unix, anyway?

  • origin: Dennis Ritchie and Thompson at Bell labs, concentrated on programming (C) and group projects. Unix and C develop side by side. Ritchie now involved with Plan 9 and Inferno.
  • Unix Wars: System V by ATT, BSD by Berkeley (based on ATT code).
  • commercial splintering: SysV (AIX, HPUX, etc.), BSD (Solaris, DEC Ultrix) p.18
  • linux (Red Hat, Slackware, Debian, SuSE distributions), BSD (freeBSD, netBSD)
  • Mac OS X
  • Pragmatic definition: unix = "unix-like", not the trademarked name owned by AT&T (then USL), then Novell, then X/Open). If it quacks like a duck...
  • Bottom line: Various flavors of unix (unixes, unices, unixen) and versions of flavors will be similar with differences. Keep the Big Picture in mind!

How is unix commonly used?

  • Stability: micro and minicomputers for research and busies
  • Portability: recompile apps and go! Unix is platform-agnostic
  • Price: massively parallel computing
  • Pared down functionality: Internet and ISP servers
  • Availability: it's everywhere
  • hobbyist fun

How is unix different

Unix has a distinctive philosophy and a specific community temperament.
  • Built as an OS with a specific group in mind; wonky and arbitrary ("cat")
  • attracts hackers (not crackers), academics, and do-it-yourselfers as well as those that demand system stability.
  • There is a huge community of *nix folks out there to compare notes with, but getting heard and answered (and not getting shredded) takes some preparation. To be accepted in the ranks and get help:
    1. Try to figure it out yourself.
    2. RTFM: faqs, how-tos, manuals, READMEs, etc


    Trick of the Trade
    A quick way to get up to speed on anything at all is to do a web search on [topic] FAQ. The FAQ for any given topic will give you the thumbnail sketch you need to get started, or to be popular at the next cocktail party.
  • Do the homework (newsgroups, mailing lists)

    Trick of the Trade
    If you're getting a reproducible error message, you can cut/paste it into a newsgroup search like Google-Deja. This will pull up messages from people who are having (and solving) the exact kind of problem you are having.
  • If you're still stuck, ask your question in such a way that the gurus know you've tried all the other steps. Be rational: no begging, no demands, no excessive punctuation. Project "cluefulness", not "cluelessness". Ask for pointers to appropriate reading material rather than an outright answer.

Dive in!

  • multi-user OS requires a login. Admin cannot see pw, and your login should not change.
  • X desktop - use a terminal instead. (further reading on X: chapter 5)
  • The command line
    • the login: what do we see? Top to bottom, left to right.
    • case sensitivity!
    • whoami - what is my login?
    • groups - what workgroups am I in (really or potentially)
    • pwd (present working directory) - where on the filesystem am I?
      You login to your home directory ~[username]
      You own the files and dirs in your home dir. (permissions will come later)
      hierarchical filesystem branching off of root ("/")
    • ls -l - what is here with me?


      Trick of the Trade
      Experienced users do two things habitually:
      1. Reality checks with ls/pwd, and
      2. save their work.

A digression about the Tao of Unix

Treading water

  • changing your passwd
  • make a file to manipulate: echo "this goes in a file" > outfile
  • look for it in the directory (hint: ls)
  • make a new directory: mkdir
  • change directories to it: cd. Special uses of CD: cd, cd ~, cd ~user
  • move your file into the new directory: mv - verify it really happened

    Trick of the Trade
    Perform a "sanity check" after you do something: did it work? How do I know it worked? Did any output land where it was supposed to land?
  • .hide the file with a .dot. (new term: .dotfiles - config files frequently end in "rc")
  • copy the hidden file to a new name: cp
  • remove (delete) the .hidden file: rm. There is no undelete...
    Sometimes rm or other destructive commands are aliased to rm -i. You can force a non-aliased form thusly: 'rm'.
  • rmdir removes empty dirs

using absolute and relative paths p.70

  • make a sister directory
  • move to it in one step

Have a peek around

  • move out of your directory and see what else is on the system
  • look at your PATH to see where the apps are; go there and look around

Shell games

  • you're already using a shell: ps
  • There are various shells available
    • sh - Bourne shell - always present. Somewhat limited.
    • csh - C shell - has a C-like syntax for scripting
    • bash - Bourne Again Shell - augmented bourne
    • ksh - Korn - like bash + csh.
    • other, highly specialized shells designed for small footprint, security, etc.
  • benefits of advanced shells: history, richer feature set
  • changing shells

Rescue operations

  • Stuck? Try breaking out with [ctrl-c].
  • terminal gone insane? Try a couple of iterations of stty sane and reset

logout!

  • exit

Homework

  • read news:comp.unix.questions
  • Shells, p. 24-27
  • Permissions, 389-393


http://www.mousetrap.net
$Id: day1.orb,v 1.15 2002/09/03 19:48:42 mouse Exp $

Remember, your login is based on your machine's hostname, not on any other number.
~/[initials] refers to the subdirectory under your homedir, named after your initials. Everything except for .dotfiles will be stored in your ~/[initials] directory.


© 1995-2001 jason carr
Distributed under the terms of the GNU Free Documentation License.