Title: Computer Club at WMU
1Computer Club at WMU
- Meetings on Thursday nights at 600 P.M.
- 4154 Dunbar Hall
- http//yakko.cs.wmich.edu
- Next Week Emacs/Xemacs
- By Erik Gillespie
- 700 P.M.
2An Introduction to the Unix Command Line
UNIX -- Not just another OS...An Attitude
3I. What is Unix
Unix is the worst operating system except for
all others. -- Berry Kercheval
- Unix as we know it is a full featured modern
operating system that is available in a wide
variety of flavors from many different vendors.
There is some flavor of Unix available for
nearly every type of hardware available today and
while they are all different they all have
certain things in common.
4The Unix Philosophy
-- Unix today is nothing less than a worldwide
culture, comprising many tools, ideas and
customs -- Harley Hahn
- Small is beautiful.
- Each program should do one thing well.
- Store data in flat ascii files.
- Programs should be reusable.
- Everything, even hardware, is a file.
5Unix is Made Up of
-- Those who do not understand Unix are condemned
to reinvent it, poorly. -- Henry Spencer
- Files
- Regular Files
- Data
- Executables lt-- usually start a process
- Directory Files
- Contain other files and directories
- Special Files
- Processes
- Running Programs
- Owned by a user
- Are managed by the Operating System
- Can not interfere with one another
6Processes
Process 1
Process 2
Process n
...
Operating System
Hardware
7Our View of the World as Users
Your Shell
OS
Shell
A shell is a process that acts as an interface to
the operating system. It allows the user to run
other programs individually and together to
accomplish a task.
8Your First Command
Man(manual) -- Documentation is your friend
- Syntax man topic
- man provides online documentation on nearly every
standard command and configuration file. - Optional Syntax man -k keyword
- man man for more details
9Other Commands Syntax command file
The bad reputation UNIX has gotten is totally
undeserved, laid on by people who don't
understand, who have not gotten in there and
tried anything. -- Jim Joyce
- cat
- grep
- more
- less
- wc
- sort
- Echos file contents to the screen
- Searches a file for a string
- Echos a file a line at a time
- Same as more but more features
- Counts the words in a file and more
- Sorts the contents of a file
10Pipes and Redirection
- The Unix philosophy involves a set of generic
tools that each do one thing and do it well. It
is not until these tools are used together that
full power of the Unix command line can be
realized. - In Unix everything (including hardware devices)
is treated as a File that can be read from and
written to.
11- Each Process Starts with Three Open Files
Program
stdout
Buffer
stdin
stderr
12Pipes
- Pipes connect stdout of one command to stdin of
another comand. i.e. - ls less
- cat student_list grep senior sort
13Pipes
Program 1
stdin
Program 2
Pipe
stdin
stdout
Program 3
Pipe
stdin
14I/O Redirection
- I/O redirection allows the user to change where
input to a command or output from a command goes
to/comes from. - cat student_list gt outfile
- program lt infile
- program lt infile gt outfile
15File System Utilities
-- You will find that the Unix file system has a
compelling beauty everything makes sense --
Harley Hahn
16Simple Unix Directory Structure
/
usr
etc
home
bin
var
...
...
...
local
bin
class
grad
ugrad
My Home Directory
...
jpeckhar
mmscott
17Your Home Directory
- Representations
- /home/grad/mmscott
- mmscott
- /
- A user generally has permission to freely
manipulate files within this directory and its
children. - Users start with their home directory as their
pwd when they login.
18Changing Directories
- The cd(Change Directory) command is used to
change directories - cd path
- Paths can be relative or absolute
- pwd reports present working directory
- cd when entered by itself sets the pwd to the
users home directory.
19Your Prompt Helps you Navigate
- The default prompt on your CS account tells you
what directory is your pwd. - Some Examples
- csy12/bingt
- csy12/home
- csy12/usr/man
20Other File System Utilities
- Lists all files in a directory
- Copies files
- Moves files
- Deletes files
- Makes directories
- Removes directories
21Basic Syntax
- ls
- cp source dest OR cp source dir
- mv source dest OR mv source dir
- rm file
- mkdir directory
- rmdir directory