Introduction to UNIX
IEEE Pizza-Talk Series --- October 8, 2004
Dr. Nickels
UNIX? What's UNIX?
- An operating system (an OS) is the computer program that
orchestrates all other programs.... gives and takes back control
from applications, manages files, etc.)
- UNIX is really a set of similarly-designed OSs, including
Solaris (Sun's OS), HP-UX (HP's OS), Linux (Including RedHat,
Gentoo, Debian, SUSE, etc.), FreeBSD, IRIX (SGI's OS), and more.
- Some syntax changes (is it "ls -l" or "ls-l"?) from system to
system, but the basics are the same.
Advocacy --- Why UNIX?
- In General
- Scalability (web farms)
- Remote Management (labs)
- Stability (web servers, e-commerce)
- Security (e-commerce)
- Quotas (labs, ISPs)
- Cost of Ownership (everyone!)
- For a desktop system
- No Drive Letters!
- No "BSOD"
- Reboots? What reboots?
- Virii
- Customization, Customization, Customization!
- Remote execution
- Native Postscript
- General Philosophy
- a specialized program for every task
- the windowing system itself is a bunch of application
programs... not part of the OS!
- different editor, spell-checker, typesetter, previewer,
printer programs --- often different choices for each, "it's the
users choice!"
- modern exceptions: netscape (though Mozilla has since broken
into multiple applications!), OpenOffice
Shells
- What is a shell/terminal window?
- Terminal window - graphical window running a text "shell"
- shell: text-based interaction with system.
- A bit of history: Before windowing systems, a shell was the
user's only interaction with system (via a dumb-terminal,
hence the "terminal window" or "terminal emulator" moniker).
Now, systems let you interact in several ways at once.
- Several different shells out there, differing mostly in syntax
(setting variables, writing scripts, etc):
- sh - the orginal shell (bourne shell)
- csh - syntax similar to the C programming language
- tcsh - extensions to csh - default for us
- bash - bourne again shell - extensions to sh
- What can I do with one?
- Lauch new text-based programs
-
cd Networks
-
man ls
-
less .tcshrc
-
spice3
- Lauch new graphical programs.
-
dtpad .tcshrc &
-
matlab &
- background/foreground and
"&"
- If you just launch a program, it runs in place
of the shell on the processor.
- If you put an
&
as the last character of the
command, the new program will istead detatch itself
from the shell, and return the shell to user
interaction. This is called running something "in
the background" and takes advantage of
multitasking.
- To recover your shell after launching a program
(without the &), type
^Z
(hold down
CNTRL and Hit Z), then type bg.
- To see what background jobs a shell is currently running, type
jobs
.
- To move a job from the background to the
foreground, type
fg
.
- How do I start a terminal window/shell?
- CDE -- Right-click on background, choose Hosts/This Host
- CDE -- Go to "cpu/disk meter menu", choose This Host
- GNOME -- Click the icon on the top button bar.
- GNOME -- Go to Menu, then....
- from a shell --
dtterm &"
- from a shell --
gnome-terminal &"
- from a PC -- From the Windows Menu, Choose Run then type
"telnet <host>"
(e.g. telnet joule.engr.trinity.edu)
- from a PC -- Use a graphical SSH program to connect (to joule from
off-campus, to any sun from on-campus). My favorite is
PuTTY, but a list of available windows ssh programs can be found at
http://www.openssh.com/windows.html
- How do I close a shell?
exit; logout
- double-click left-top button
- Hints and Tips
- arrow keys and editing previous commands
- tab completion and ^D listing
Files and Directories on UNIX
- Useful commands
- Command Format --
command [options] [arguments]
- Syntax note:
[]
means optional
parameter
- Syntax note:
<>
means required
parameter
- options often start with
-
, only one
-
is required (e.g. ls -alF
)
- Directory Navigation & Control
cd [DIRECTORY/PATH]
-- change directory
(goes to home directory without argument)
mkdir <DIRECTORY>
-- make new directory
rmdir <DIRECTORY>
-- remove (empty) directory
ls [DIRECTORY]
-- list current or named
directory
ls -a
-- list all files (files that begin
with the character .
are normally
hidden).
ls -l
-- long listing
ls -F
-- put a special character beside
non-normal files (/ for directories, * for executable files,
@ for symbolic links, etc).
- File Maintenance
rm <file>
-- remove file
less <file>
-- examine file; <sp> to cont;
q to quit
cp <file> <file2 or directory>
-- copy file
mv <file> <file2 or directory>
-- move file
lpr <file>
-- print file (only
do this with text or postscript files (NOT PDF/Graphics!!)
- Help
man <command>
-- view help text about
<command>; <sp> to continue; q to quit
man -k <keyword>
-- what commands involve
<keyword>??
- Interesting Directories
-
/tmp
-- temporary directory, read/write by
anyone. Gets cleaned on every boot-up!
-
/home/user
-- home directory.
Read/write by only you.
-
/home/linuxhome/user
(on Suns) -- linux home directory.
Your linux home directory, when on the Suns.
-
/rexhome/user
(on Linux) -- sun home directory.
Your sun home directory, when on the Linux machines.
-
X:
(on ITS PCs) -- sun home directory.
Your sun home directory, when on ITS PCs.
-
/home/user/public_html
-- We are running a web
server for you! -- files in this directory
(one the Suns) can be accessed through
http://www.engr.trinity.edu/~user
-
/NetHood
-- (If you are running
Sharity&
) this maps to the Windows "Network
Neighboorhood". Therefore, to access your Y: drive from unix,
type cd /NetHood/TUCC-TIGER/Users/username
(entering your ITS password!)
-
.
-- shorthand for the current directory.
-
..
-- shorthand for the parent directory.
-
~
-- shorthand for your home directory.
- Interesting Files
-
/home/user/public_html/index.html
-- the default
file that someone sees if they access
http://www.engr.trinity.edu/~user
-
core
-- system file generated when a program
crashes. You may safely delete any and all of these.
- Hidden Files - any file starting with a period (.) is
normally hidden.
-
.bashrc
-- configuration for bash
-
.forward
-- where to forward your email (see
below)
E-mail forwarding
- ALTERNATIVE: We also run a POP3 server on rex.engr.trinity.edu,
so you can configure some email clients (the program that you
run on your machine) to just grab it from there instead of
forwarding.
- WARNING! If you create a loop (account A forwards to B,
which forwards to A, ...) you will lose email and possibly
create problems on both systems.
- To forward from the exchange server to another server (for
example, the engineering server, rex.engr.trinity.edu):
--- You have to call or email the helpdesk
(helpdesk@trinity.edu, x7409). Microsoft (or ITS, I don't
know) doesn't allow users to do this: maybe it'll be in the
next version
:)
- To forward from your engineering account to your exchange
account, or any other account --- Edit a text file called
.forward
in your home directory. This file should
contain one line, the email address to which you wish your email
sent.
Some (other) good sources of information
Prev: Gnome
Next: Local Applications