<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="presenter.xsl"?>
<slideshow>
	<title> Unix Basics </title>
	<slide> <!-- title slide -->
		<body>
			<h1 style="color:blue;margin-top:200px;margin-left: 100px; font-size: 36pt;margin-bottom:0px">
			Unix Essentials 
			</h1>
			<h4 style="font-style: italic; color: darkblue;margin-left: 200px;margin-top: 0px;"> 
			... or everything I can fit in 2 hours!
			</h4>

			<div style="margin-top:200px;"> 
			Computer Science House
			<p/>
			Jordan Sissel<br/>
			jls@csh.rit.edu
			</div>

		</body>
	</slide>

	<slide> <title> Introductions </title>
		<body>
			Hi! Welcome to the Basic Unix Essentials seminar/workshop!

			<p/>

			I am your geeky host, Jordan Sissel.

			<p/>

			Obey me.

			<p/>

			If you have questions during the presentation, ask them and I will
			answer them. However, keep in mind that I may be answering your
			question soon in the slides, anyway.

			<p/>

			Mostly, try to focus questions on confusion about the material, rather
			than focusing on "what if foo?" type questions. Write down other
			questions and save them for question breaks, if you can.

		</body>
	</slide>

	<slide> <title> Goals  </title>
		<body>
			At the end of this seminar, you should feel at least mildly comfortable in a Unix system environment.

		</body>
	</slide>

	<slide> <title> Agenda </title>
		<body>
			<ul>
				<li> What is Unix? </li>
				<li> Basic Environment </li>
				<li> The Shell </li>
				<li> The File System </li>
				<li> Graphical Environment </li>
			</ul>
		</body>
	</slide>

	<slide> <title> What is Unix? </title>
		<body>
			Unix is a term often used for a class of Operating Systems such as
			Solaris, GNU/Linux, and FreeBSD.

			<p/>
			Lets start by relating to what you already know:

			<ul>
				<li> If you use Windows: Unix is different. </li>
				<li> If you use OSX: Unix is different. </li>
			</ul>

			That was helpful, wasn't it?

			<p/>

			What does <i>different</i> mean?

			<p/>

			It's mean and scary... <i>or is it?</i>

		</body>
	</slide>

	<slide> <title> Basic Environment </title>
		<body>
			Unix environment components
			<ul>
				<li> Getting access </li>
				<li> Graphical programs </li>
				<li> The Terminal </li>
				<li> The Shell </li>
				<li> Command-line programs </li>
				<li> The File System </li>
			</ul>
		</body>
	</slide>

	<slide> <title> Getting Access </title>
		<body>
			There are usually two ways to access a Unix system:
			<ul>
				<li> Local access - usually graphical </li>
				<li> Remote access - usually terminal-based </li>
			</ul>

			The first thing you need, is a user account.
			<p/>

			An account is a username (and password) that identifies you and lets
			the system decide if you are allowed access.
		</body>
	</slide>

	<slide> <title> Local Access </title>
		<body>
			Features of local access:
			<ul>
				<li> Graphical Interface </li>
				<li> Easy access to local graphical programs. </li>
			</ul>

			Local access is what you do when you're at home on your own Windows or Mac computer.

			<p/>

			Let's login now! (if you haven't already)

		</body>
	</slide>

	<slide> <title> Remote Access </title>
		<body>
			Features of remote access:
			<ul>
				<li> Terminal (text) Interface </li>
				<li> Access to graphical programs limited </li>
			</ul>

			How do I access a system remotely?
			<ul>
				<li> SSH </li>
				<li> Telnet (maybe) </li>
			</ul>

			We'll try this later. 

		</body>
	</slide>

	<slide> <title> The Terminal </title>
		<body>
			Terminals are great!
			
			<p/>
			However, we don't know how to start them yet... 

			<p/>

			We'll come back to this.
		</body>
	</slide>

	<slide> <title> Graphical Environment </title>
		<body>
			Pros and cons:
			<ul>
				<li> Pro: Lots of interface environments = diversity </li>
				<li> Con: Lots of interface environments = diversity </li>
			</ul>

			X Window System, called X for short, is the graphical system for most
			Unix systems you're going to use.

			<p/>

			X simply provides a means to draw windows. Window managers are used to
			draw window borders and provide other features.

			<p/>

			What does X look like?

		</body>
	</slide>

	<slide> <title> fvwm2 #1 </title> 
		<body> <img src="images/fvwm2-dadou.png" /> </body> 
	</slide>
	<slide> <title> fvwm2 #2 </title> 
		<body> <img src="images/fvwm2-horen.jpg" /> </body> 
	</slide>
	<slide> <title> AfterStep </title>
		<body> <img src="images/afterstep-oz.jpg" /> </body> 
	</slide>
	<slide> <title> GNOME #1 </title> 
		<body> <img src="images/metacity-gnome.png" /> </body> 
	</slide>
	<slide> <title> ctwm </title> 
		<body> <img src="images/ctwm.png" /> </body> 
	</slide>
	<slide> <title> fluxbox </title> 
		<body> <img src="images/fluxbox.png" /> </body> 
	</slide>
	<slide> <title> ion </title> 
		<body> <img src="images/ion.png" /> </body> 
	</slide>
	<slide> <title> enlightenment </title> 
		<body> <img src="images/enlightenment.png" /> </body> 
	</slide>
	<slide> <title> GNOME #2 </title> 
		<body> <img src="images/gnome-2.png" /> </body> 
	</slide>
	<slide> <title> GNOME #3 </title> 
		<body> <img src="images/gnome-3.png" /> </body> 
	</slide>

	<slide> <title> Graphical Environment (cont) </title> <body>
			Back to business...

			<p/>

			Moving from Windows/OSX to Unix, you may feel more comfortable using <i>Desktop Environment</i> software. Such software includes:

			<ul>
				<li> GNOME </li>
				<li> KDE </li>
				<li> Xfce </li>
			</ul>

			These are full workstation environments similar to those of Windows
			and OSX. They often come with tools, toys, and games.

		</body>
	</slide>

	<slide> <title> GNOME </title> 
		<body>
			GNOME is often the standard desktop environment on many popular Linux
			distributions.

			<p/>
			
			It is also the standard environment on Solaris.

			<p/>

			The project aims to provide "an intuitive and attractive desktop for users" (quoted from gnome.org)

			<p/>

			If you have never used Linux or Solaris, GNOME should help you feel
			more comfortable when using them.

		</body>
	</slide>

	<slide> <title> Using GNOME </title>
		<body>
			You'll need a mouse and a keyboard.

			<p/>

			The Applications button is similar to the 'start' button in Windows.

			<p/> 

			The desktop and its icons should behave similarly to OSX and Windows.
		</body>
	</slide>

	<slide> <title> Things You Should Know </title>
		<body>
		Moving Windows:
		<ul>
			<li> Windows can be dragged by holding <i>ALT</i> while left-click dragging them. </li>
			<li> Windows can be resized by holding <i>ALT</i> while middle-click dragging them. </li>
		</ul>

		Copying Text:
		<ul>
			<li> Most text is automatically copied when you select it </li>
			<li> Most interfaces understand "middle click means paste" </li>
			<li> This is called "Grab and Splat" and is very useful </li>
		</ul>
		</body>
	</slide>

	<slide> <title> Most Important Feature Ever </title>
		<body>
			Change your background image!

			<ul>
				<li> Right-click on the desktop </li>
				<li> Select 'Change desktop background' </li>
				<li> Pick a background </li>
				<li> Resume life. </li>
			</ul>

			Feel more at home, yet?
		</body>
	</slide>

	<slide> <title> Run Your First Application </title>
		<body>
			Click on the <i>Applications</i> button.

			<p/>

			Pick something to run. How about Minesweeper (GNOME Mines)?
		</body>
	</slide>

	<slide> <title> Adding Programs to the Panel </title>
		<body>
			You can add this (or any) program to the quicklaunch panel:
			<ul>
				<li> Right-click on the panel </li>
				<li> "Add to panel" </li>
				<li> "Launcher from menu" </li>
				<li> Pick the application </li>
				<li> Take a nap </li>
			</ul>
		</body>
	</slide>

	<slide> <title> Run a Terminal </title>
		<body>
			<i>Applications</i> -&gt; <i>System Tools</i> -&gt; <i>Terminal</i>

			<p/>

			You may want to add this application to the panel at this time. It's
			useful to have within short reach.
		</body>
	</slide>

	<slide> <title> Using the terminal </title>
		<body>
			A terminal provides a means by which to allow you to easily interact with your shell.

			<p/>

			The terminal knows things about the window size, input/output
			features, colorization, cursor movement, etc. It allows you to provide
			input to your shell (and other programs).

			<p/>

			Input using the keyboard.
		</body>
	</slide>

	<slide> <title> Configuring the terminal program </title>
		<body>
			GNOME's terminal program, called <i>gnome-terminal</i>, is configurable. You can define profiles which set:
			<ul>
				<li> foreground (text) and background color </li>
				<li> font family and size </li>
				<li> scrollback buffer </li>
				<li> a few other things </li>
			</ul>

			Right-click in the terminal and choose 'Edit Current Profile'

			<p/>

			I like white text on black background, as it's very easy to read.

		</body>
	</slide>

	<slide> <title> The Shell</title>
		<body>
			A shell is a text-based interface to your system.

			<p/>

			Most shells provide a common subset of features:
			<ul>
				<li> Basic line editing </li>
				<li> Command path list </li>
				<li> File and Command completion </li>
				<li> Configurable prompt </li>
			</ul>
		</body>
	</slide>

	<slide> <title> Basic line editing </title> 
		<body>
			<i>Note: Control+X is often abbreviated ^X </i>
			<dl>
				<dt> Ctrl+L </dt> <dd> Clear the screen </dd>
				<dt> Ctrl+W </dt> <dd> Delete the previous word (starting at cursor)</dd>
				<dt> Ctrl+U </dt> <dd> Clear the line </dd>
				<dt> Left and Right arrow keys </dt> <dd> Move the cursor </dd>
				<dt> Up and Down arrow keys </dt> <dd> Command history traversal </dd>
			</dl>
		</body>
	</slide>

	<slide> <title> Executing a command </title> 
		<body>
			Type your command, and press enter. Simple, eh?

			<p/>

			Try this the 'ls' command. 'ls' will list directory contents.
		</body>
	</slide>

	<slide> <title> Command and File completion</title>
		<body>
			Most shells will complete file and command names, when possible, when you tell them to.

			<p/>
			
			For instance, if I execute 'ls' to see the directory contents:
			<code><![CDATA[nfwire(~) % ls
four    hello   one     three   two
]]></code>

			Typing 'he' and pressing <i>Tab</i> will make the shell automagically
			complete your word to 'hello' becuase it sees that 'hello' is a file,
			and starts with 'he'
		</body>
	</slide>

	<slide> <title> Less - a text pager </title>
		<body>
			<code><![CDATA[less /usr/share/dict/words]]></code>

			This will run less and start you viewing the file specified. You start
			at the top of the file.

			Navigation:
			<dl>
				<dt> Arrow keys </dt>
				<dd> Move around </dd>
				<dt> Page Up/Page Down </dt>
				<dd> Take a guess! </dd>
				<dt> /foo </dt>
				<dd> search for 'foo' in the document </dd>
				<dt> ?foo </dt>
				<dd> reverse search for 'foo' in the document </dd>
				<dt> n </dt>
				<dd> find next </dd>
				<dt> N </dt>
				<dd> find previous </dd>
			</dl>
		</body>
	</slide>

	<slide> <title> Getting help in Unix </title>
		<body>
			<ul>
				<li> Most OS's will come with documentation. </li>
				<li> View documentation with the "man" program </li>
			</ul>

			Example:
			<code><![CDATA[man ls]]></code>

			This will open the manpage for "ls" in the default pager. Most of the
			time, the default pager is 'less' - so you'll need to know how to use
			less.

			<p/>

			Searching in 'less' will help you find that you need in a manpage.
		</body>
	</slide>

	<slide> <title> Break(dance?) for Questions </title>
		<body>
			The next sections will introduce several basic commands.

			<p/>

			If you have questions about what was previously covered, feel free to
			ask them now.
		</body>
	</slide>

	<slide> <title> Unix Commands </title>
		<body>
			<ul>
				<li> File system commands </li>
				<li> Data commands </li>
				<li> Common shell commands </li>
			</ul>
		</body>
	</slide>

	<slide> <title> File System Commands </title>
		<body>
			<table border="0" width="100%">
				<tr>
				<td>
					<dl>
						<dt> pwd </dt> <dd> Show current directory </dd>
						<dt> ls </dt> <dd> List directory contents </dd>
						<dt> cd </dt> <dd> Change directory </dd>
						<dt> rm </dt> <dd> Remove files </dd>
						<dt> mv </dt> <dd> Rename or move files </dd>
					</dl>
				</td>
				<td>
					<dl>
						<dt> mkdir </dt> <dd> Make a directory </dd>
						<dt> rmdir </dt> <dd> Remove directories </dd>
						<dt> chmod </dt> <dd> Change file modes (permissions) </dd>
						<dt> chown </dt> <dd> Change file ownership </dd>
						<dt> chgrp </dt> <dd> Change group ownership </dd>
					</dl>
				</td>
				</tr>
			</table>
		</body>
	</slide>

	<slide> <title> pwd </title>
		<body>
			'pwd' tells you where you are. It means <i>print working directory</i>.

			<p/>
			
			Usage: <code> pwd </code>

			Example:
			<code>nfwire(~/projects) % pwd
/home/jls/projects</code>

		</body>
	</slide>

	<slide> <title> ls </title>
		<body>
			'ls' lists directory contents.

			<p/>

			Usage: ls [-laRF]

			<dl>
				<dt> -l (lowercase L) </dt> <dd> Specify long format </dd>
				<dt> -a </dt> <dd> Show "hidden" files </dd>
				<dt> -R </dt> <dd> Recurse through directories </dd>
				<dt> -F </dt> <dd> Identify special files </dd>
			</dl>

			"Hidden" files or directories in unix filesystems are files beginning
			with '.' - such as '.firefox'

			Sample output:
			<code><![CDATA[nfwire(~/s) % ls -l
total 2
-rw-r--r--  1 jls  jls    0 Mar 28 20:19 four
drwxr-xr-x  2 jls  jls  512 Mar 28 23:16 happy
-rw-r--r--  1 jls  jls    0 Mar 28 20:19 hello
-rw-r--r--  1 jls  jls    0 Mar 28 20:19 one
-rw-r--r--  1 jls  jls    0 Mar 28 20:19 three
-rw-r--r--  1 jls  jls    0 Mar 28 20:19 two

nfwire(~/s) % ls -a
.       ..      four    happy   hello   one     three   two

nfwire(~/s) % ls -la
total 12
drwxr-xr-x   3 jls  jls   512 Mar 28 23:16 .
drwxr-xr-x  22 jls  jls  8192 Mar 28 23:11 ..
-rw-r--r--   1 jls  jls     0 Mar 28 20:19 four
drwxr-xr-x   2 jls  jls   512 Mar 28 23:16 happy
-rw-r--r--   1 jls  jls     0 Mar 28 20:19 hello
-rw-r--r--   1 jls  jls     0 Mar 28 20:19 one
-rw-r--r--   1 jls  jls     0 Mar 28 20:19 three
-rw-r--r--   1 jls  jls     0 Mar 28 20:19 two

nfwire(~/s) % ls -F
four    happy/  hello   one     three   two

nfwire(~/s) % ls -RF
four    happy/  hello   one     three   two

./happy:
test
]]></code>

		</body>
	</slide>

	<slide> <title> cd </title>
		<body>
			Change Directory

			Usage: <code> cd [path] </code>

			Example:
			<code><![CDATA[nfwire(~/s) % pwd
/home/jls/s
nfwire(~/s) % cd /
nfwire(/) % pwd
/]]></code>

		</body>
	</slide>

	<slide> <title> mkdir </title>
		<body>
			Make a directory.

			Usage: <code> mkdir [path] </code>

			Example: 
			<code><![CDATA[nfwire(~/s) % mkdir test
nfwire(~/s) % cd test
nfwire(~/s/test) % pwd
/home/jls/s/test]]></code>
		</body>
	</slide>

	<slide> <title> rm </title>
		<body>
			Remove a file.

			<p/>

			Usage: <code><![CDATA[rm [-fir] path ...]]></code>

			<dl>
				<dt> -f </dt>
				<dd> force removal (do not ask) </dd>
				<dt> -i </dt>
				<dd> ask before removing any file </dd>
				<dt> -r </dt>
				<dd> recurse through directories </dd>
			</dl>

			Example:
			<code><![CDATA[nfwire(~/s/test) % ls -l a
-rw-r--r--  1 jls  jls  0 Mar 29 00:06 a
nfwire(~/s/test) % rm a
nfwire(~/s/test) % ls -l a
ls: a: No such file or directory

nfwire(~/s) % ls foo/
a       b
nfwire(~/s) % rm -rf foo
nfwire(~/s) % ls foo/
ls: foo/: No such file or directory]]></code>


		</body>
	</slide>

	<slide> <title> mv </title>
		<body>
			Rename or move files and directories.

			<p/>
			
			Usage: <code><![CDATA[mv src1 [src2 ... srcN] dest]]></code>

			<ul>
				<li> Sources can be files or directories to be moved. </li>
				<li> Destination can also be a file or directory name </li>
				<li> Only a directory is allowed if multiple sources specified </li>
			</ul>

			Example: <code><![CDATA[nfwire(~/s/test) % ls
a
nfwire(~/s/test) % mv a b
nfwire(~/s/test) % ls
b
]]></code>

		</body>
	</slide>

	<slide> <title> rmdir </title>
		<body>
			Remove directories.

			<p/>

			Directories must be empty before you can delete them.

			<p/>

			Usage: <code> rmdir directory ... </code>

			Example:
			<code><![CDATA[nfwire(~/s) % ls test
b
nfwire(~/s) % rmdir test
rmdir: test: Directory not empty
nfwire(~/s) !1! % rm test/b 
nfwire(~/s) % rmdir test
nfwire(~/s) % ls test
ls: test: No such file or directory]]></code>

		</body>
	</slide>

	<slide> <title> chmod </title>
		<body>
			Change mode (access permissions).
			
			Usage: <code><![CDATA[chmod mode file ...]]></code>

			Modes are 3-tuple octal values: XXX. First letter (left) is owner
			permissions, middle letter is group permissions, last (right) letter
			is world permissions.

			<ul>
				<li> 400 : Allow read by owner. </li>
				<li> 200 : Allow write by owner. </li>
				<li> 100 : For files, allow execution by owner.  For directories, allow the owner to search in the directory. </li>
				<li> 040 : Allow read by group members. </li>
				<li> 020 : Allow write by group members. </li>
				<li> 010 : For files, allow execution by group members.  For directories, allow group members to search in the directory. </li>
				<li> 004 : Allow read by others. </li>
				<li> 002 : Allow write by others. </li>
				<li> 001 : For files, allow execution by others.  For directories allow others to search in the directory. </li>
			</ul>

		</body>
	</slide>

	<slide> <title> chmod (cont'd) </title>
		<body>
			Example permissions:
			<dl>
				<dt> 755 </dt>
				<dd> Owner: read, write, execute. Group: read, execute. World: read, execute </dd>
				<dt> 644 </dt>
				<dd> Owner: read, write. Group: read. World: read </dd>
				<dt> 600 </dt>
				<dd> Owner: read, write. Group: nothing. World: nothing </dd>
			</dl>

			<font color="red">
			Directories <b>MUST</b> be executable for listing (ls command) to
			work. Execute on a directory means "search" access.
			</font>

			<p/>

			The following file has permissions 644:

			<code><![CDATA[nfwire(~/s) % ls -l two
]]><b>-rw-r--r--</b><![CDATA[  1 jls  jls  0 Mar 28 20:19 two
 ^^^^^^^^^ <- Permission flags
]]></code>


		</body>
	</slide>

	<slide> <title> Data commands </title>
		<body>
			<dl>
				<dt> cat </dt> <dd> concatenate files </dd>
				<dt> grep </dt> <dd> search file contents </dd>
				<dt> diff </dt> <dd> compare files and show differences </dd>
				<dt> sort </dt> <dd> sort data </dd>
				<dt> uniq </dt> <dd> find unique elemenets </dd>
				<dt> find </dt> <dd> find files </dd>
				<dt> file </dt> <dd> identify a file by its data </dd>
			</dl>
		</body>
	</slide>

	<slide> <!-- CAT!!! -->
		<body>
			<img src="cat.jpg" />
		</body>
	</slide>

	<slide> <title> cat </title>
		<body>
			Concatenate and dump file contents.

			Usage: <code><![CDATA[cat file ...]]></code>

			Example:
			<code><![CDATA[nfwire(~/s) % cat Unix
unix rules!

Hurray!

nfwire(~/s) % cat Unix Unix
unix rules!

Hurray!
unix rules!

Hurray!]]></code>

		</body>
	</slide>

	<slide> <title> grep </title>
		<body>
			Print lines matching a given pattern. This tool is infinitely useful
			when you need to search lots of files for keywords.

			<p/>

			Usage: <code><![CDATA[grep pattern file ...]]></code>

			Patterns are any valid regular expression. Plain words are valid :)

			<p/>

			Example:
			<code><![CDATA[nfwire(~/s) % grep rules Unix
unix rules!

prague% grep 'public static void main' *.java
Dommy.java:  public static void main (String[] args) throws Exception {
MyXML.java:  public static void main (String[] args) throws Exception {
MyXSL.java:     public static void main(String[] args) throws Exception {]]></code>
		</body>
	</slide>

	<slide> <title> diff </title>
		<body>
			Compare files and show differences.

			<p/>

			Usage: <code><![CDATA[diff [-cu] file1 file2]]></code>

			Example:
			<code><![CDATA[nfwire(~/s) % diff -u Unix Unix.2
--- Unix        Wed Mar 29 00:37:33 2006
+++ Unix.2      Wed Mar 29 00:44:53 2006
@@ -1,3 +1,3 @@
unix rules!

-Hurray!
+Happy!]]></code>
		</body>
	</slide>

	<slide> <title> sort </title>
		<body>
			Sort data the way you like it.

			<p/>

			Usage: <code><![CDATA[sort [-nr] [file ...]]]></code>

			<dl>
				<dt> -n </dt>
				<dd> Sort numerically. That is, '99' &lt; '100'. Normally, '99' comes after.</dd>
				<dt> -r </dt>
				<dd> Reverse sort order </dd>
			</dl>

		</body>
	</slide>

	<slide> <title> sort (cont'd) </title>
		<body>
			Examples:
			<code><![CDATA[nightfall(~) % cat unsorted 
101
99
100
nightfall(~) % sort unsorted
100
101
99
nightfall(~) % sort -n unsorted
99
100
101]]></code>

		</body>
	</slide>

	<slide> <title> uniq </title>
		<body>
			Filter out (grab unique) lines in data
			<p/>

			Usage: <code><![CDATA[uniq [-c] [inputfile]]]></code>

			<dl>
				<dt> -c </dt>
				<dd> Display total counts for each unique hit </dd>
			</dl>

			uniq will only look at adjacent lines for uniqueness comparisons,
			therefore the data set may need to be sorted first.
		</body>
	</slide>

	<slide> <title> uniq(cont'd) </title>
		<body>
			Example:
			<code><![CDATA[nightfall(~) % cat data
hello
one
two
hello
there
one
one
nightfall(~) % sort data | uniq -c
   2 hello
   3 one
   1 there
   1 two]]></code>
		</body>
	</slide>

	<slide> <title> find </title>
		<body>
			Find files by name or attribute.

			<p/>

			Usage: <code><![CDATA[find [pathname ...] [expression]]></code>

			Some valid expressions include:

			<dl>
				<dt> -name '*.jpg' </dt>
				<dd> Print files ending in '.jpg' </dd>
				<dt> -name 'MyClass.java' </dt>
				<dd> Print files called 'MyClass.java' </dd>
			</dl>

		</body>
	</slide>

	<slide> <title> find (cont'd) </title>
		<body>
			Example:
			<code><![CDATA[prague% find ~/ -name 'MyXML.java'
/home/stu13/s9/jls9398/old/classes/xml/7/MyXML.java

prague% find ./ -name '*.png'
./old/CSLOGO.png
./exp51.png
./exp52.png
./exp53.png
./exp4.1.png
./exp4.2.png
./exp4.3.png]]></code>
		</body>
	</slide>

	<slide> <title> file </title>
		<body>
			Identify file type by contents

			<p/>

			Usage: <code><![CDATA[file filename ...]]></code>

			Examples:
			<code><![CDATA[prague% file . exp4.1.png euclid.pl 
.:              directory
exp4.1.png:     PNG image data
euclid.pl:      executable /usr/bin/perl script
]]></code>

		</body>
	</slide>

	<slide> <title> Common Shell Commands </title>
		<body>
			<ul>
				<li> history </li>
				<li> echo </li>
				<li> export </li>
			</ul>
		</body>
	</slide>

	<slide> <title> history </title>
		<body>
			Display a list of recently executed commands.

			<p/>

			<font color="red">NOTE: The specific usage of this command varies by shell </font>

			<p/>

			Generally, typing 'history' is what you'll probably want. it shows some recent commands.

			<code><![CDATA[prague% history
  319  ls
  320  w
  321  dmesg
  322  stty -a
  323  w
  324  ls
  325  ls -al
  327  man ls
  328  man rm
  329  MANPATH=/usr/share/man man rm
  330  ls
  331  find ./ -name '*.java'
  332  cd old/classes/xml/7
  333  ls
  334  grep 'public static void main' *.java]]></code>
		</body>
	</slide>

	<slide> <title> echo </title>
		<body>
			Print out the arguments.

			Usage: <code><![CDATA[echo [string ...]]]></code>

			Example:
			<code><![CDATA[nightfall(~) % echo "Hello there"
Hello there]]></code>

		</body>
	</slide>

	<slide> <title> export </title>
		<body>
			Declare a variable as one to be exported to the environment to new commands.

			<p/>

			Usage: <code><![CDATA[export [NAME ...]]]></code>

			Example:
			<code><![CDATA[export EDITOR]]></code>

		</body>
	</slide>

	<slide> <title> Shell Configuration </title>
		<body>
			Meaningful environment variables:
			<ul>
				<li> PATH - a list of paths from which to search for programs </li>
				<li> EDITOR - default editor to use </li>
				<li> PAGER - default pager to use </li>
			</ul>

			PATH is a colon-delimited list of program paths, such as:
			<code>PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin</code>

			EDITOR should contain the default editor you want to use.
			<code>EDITOR=vim</code>

			PAGER should contain your desired default pager program.
			<code>PAGER=less</code>
		</body>
	</slide>

	<slide> <title> Shell Configuration (cont'd) </title> 
		<body>
			Your shell probably has lots of options you can configure. The shell's documentation will tell you what these are.
			
			<p/>

			A common change to make in your shell is to customize your prompt. If you are using Bash as your shell, then you need to configure the <i>PS1</i> variable.

			<p/>
			For instance, to have your prompt be:
			<code>hostname(pwd) %</code>
			You will want to "run" this in your shell:
			<code>PS1="\h(\w) % "</code>

			Technically you aren't 'running' anything so much as setting a
			variable. Many shells have scripting languages or concepts.

		</body>
	</slide>

	<slide> <title> Process Tools </title>
		<body>
			<ul>
				<li> Processes are running commands. </li>
				<li> Identified by a unique id, called a process id, or <i>pid</i>. </li>
			</ul>

			Process-related commands:
			<ul>
				<li> ps </li>
				<li> kill </li>
				<li> pkill </li>
			</ul>
		</body>
	</slide>

	<slide> <title> ps (Linux/Solaris) </title>
		<body>
			Show process status (in list form). Allows you to view your's and other's processes.

			<p/>

			Usage (Linux/Solaris): <code><![CDATA[ps [-ef -o fmt]]]></code> 

			<dl>
				<dt> -e (linux/solaris) </dt>
				<dd> list all processes running </dd>
				<dt> -f (linux/solaris) </dt>
				<dd> full (longer) listing information </dd>
				<dt> -o fmt (bsd/linux/solaris) </dt>
				<dd> Customize the output format of ps. Read the manpage for formatting </dd>
			</dl>

		</body>
	</slide>

	<slide> <title> ps (BSD-style) </title>
		<body>
			Show process status (in list form). Allows you to view your's and other's processes.

			<p/>

			Usage (BSD): <code><![CDATA[ps [-ax -o fmt]]]></code> 

			<dl>
				<dt> -a (bsd) </dt>
				<dd> show all processes </dd>
				<dt> -x (bsd) </dt>
				<dd> show background processes too </dd>
				<dt> -o fmt (bsd/linux/solaris) </dt>
				<dd> Customize the output format of ps. Read the manpage for formatting </dd>
			</dl>

		</body>
	</slide>

	<slide> <title> ps (cont'd) </title>
		<body>
			In the example below, I use <i>$USER</i>. This is a variable your shell
			has which contains your username. So, we are using grep to filter the
			process list for our processes.

			<p/>

			Examples:
			<code><![CDATA[ prague% ps -ef | grep $USER
jls9398 22218 22216  0   Dec 08 pts/6    0:00 zsh
jls9398 13760 13758  0 00:07:15 pts/2    0:00 zsh
jls9398 13799 13760  0 00:14:13 pts/2    0:00 grep jls9398
jls9398 13798 13760  0 00:14:13 pts/2    0:00 ps -ef
jls9398 13758 13756  0 00:07:15 ?        0:00 /opt/openssh/sbin/sshd]]></code>
		</body>
	</slide>

	<slide> <title> kill </title>
		<body>
			Send signals to processes (Like the KILL signal).

			Usage: <code><![CDATA[kill -SIGNAL pid ...h]]></code>

			Valid signals are:
			<dl>
				<dt> TERM (kill -TERM)</dt>
				<dd> the terminate signal, process should die off cleanly </dd>
				<dt> INT (kill -INT)</dt>
				<dd> the interrupt signal. Hitting Control+C sends this aswell </dd>
				<dt> KILL (kill -KILL)</dt>
				<dd> An unavoidable signal. The process will die without cleanup </dd>
			</dl>

		</body>
	</slide>

	<slide> <title> kill (cont'd) </title>
		<body>
			Kill example.

			<p/>

			We are running 'cat' in another terminal. We'd like to destroy it.
			<code><![CDATA[prague% pgrep cat
13834
prague% kill -KILL 13834
prague% pgrep cat
prague% 
]]></code>

		Wait. What's pgrep?

		</body>
	</slide>

	<slide> <title> pgrep and pkill </title>
		<body>
			Find or signal a process by attribute. What?

			<p/>

			<ul>
				<li> pgrep lets you search for processes.</li>
				<li> pkill lets you signal processes.</li>
			</ul>

			Both of these take similar options.

			Examples:
			<code><![CDATA[prague% pgrep cat
13848
prague% pkill cat
prague% pgrep cat
prague% 
]]></code>

		</body>
	</slide>

	<slide> <title> Job Control </title>
		<body>
			<ul>
				<li> Jobs are processes running from your shell </li>
				<li> You can have multiple jobs executing at the same time </li>
				<li> Control+Z, backgrounding, bg, fg, jobs </li>

				Example:
				<code><![CDATA[prague% cat
^Z
zsh: suspended  cat
prague% jobs
[1]  + suspended  cat
prague% fg
[1]  + continued  cat
]]></code>

			</ul>
		</body>
	</slide>

	<slide> <title> Job Control (cont'd) </title>
		<body>
			You can start jobs in the background with '&amp;'

			<code><![CDATA[prague% du -hs . &
[1] 13854]]></code>

			Your shell will alert you when the process has finished (or died).

			<code><![CDATA[[1]  + done       du -hs .]]></code>

			'jobs' will tell you all your running jobs started from this shell:

			<code><![CDATA[prague% jobs
[1]  + suspended  du -hs /]]></code>
		</body>
	</slide>

	<slide> <title> Job Control (cont'd #2) </title>
		<body>
			<ul>
				<li> Jobs can be sent to the background with the 'bg' command </li>
				<li> Bring a job to the foreground with 'fg' </li>
				<li> Kill a job by running 'kill %1' where '1' is the job number </li>
				<li> Kill the recent job with 'kill %' </li>
			</ul>
		</body>
	</slide>

	<slide> <title> The File System </title>
		<body>
			Typical layout of a Unix system:

			<dl>
				<dt> / </dt> <dd> Root directory </dd>
				<dt> /bin </dt> <dd> Fundamental user utilities </dd>
				<dt> /sbin </dt> <dd> System and administrative  programs</dd>
				<dt> /usr </dt> <dd> majority of user utilities and applications </dd>
				<dt> /usr/bin </dt> <dd> common utilities, tools, and applications  </dd>
			</dl>
		</body>
	</slide>

	<slide> <title> Unix Features </title>
		<body>
			<ul>
				<li> Data pipes </li>
				<li> Data flow redirection (still, like pipes) </li>
			</ul>
		</body>
	</slide>

	<slide> <title> Pipes </title>
		<body>
			Unix has a concept of pipes. That is, data output can be redirected to
			the inputs of other programs.

			<p/>

			This philosophy of directable output is arguably Unix's most powerful feature.

			<p/>

			Example situation:
			<ul>
				<li> You want to see the top 10 largest directories in your home directory </li>
				<li> 'du' command will show file/directory sizes </li>
				<li> 'sort' will sort output </li>
				<li> 'tail' will display the last N lines of output </li>
			</ul>

		</body>
	</slide>

	<slide> <title> Pipes example </title>
		<body>
			<code><![CDATA[prague% du -s */ | sort -n | tail -10 
15      SR180.STR_files/
27      xfonts/
30      dtrace/
38      bin/
128     repository/
217     projects/
472     class/
586     admin/
2908    public_html/
10726   old/]]></code>
		</body>
	</slide>

	<slide> <title> Pipes example - Analysis </title>
		<body>
			<dl>
				<dt> du -s */ </dt>
				<dd> Calculate total size of files inside each directory </dd>
				<dt> sort -n </dt>
				<dd> Sort output numerically </dd>
				<dt> tail -10 </dt>
				<dd> display last 10 lines of output </dd>
			</dl>

			The output of 'du' is sent to the input of 'sort', who's output is sent to tail.

			<p/>

			This is why pipes are powerful. Instead of needing a special program
			to show the top 10 largest directories, you can use 3 already-written
			programs and pipe outputs.
				
		</body>
	</slide>

	<slide> <title> File redirection </title>
		<body>
			File redirection is very similar in principle to pipes.

			<p/>

			You use '&lt;' and '&gt;' to direct data from files to/from input/output.

			<dl>
				<dt> ps -ef &gt; bar </dt>
				<dd> Direct standard output of 'ps -ef' to the file 'bar' </dd>
				<dt> sort &lt; bar </dt>
				<dd> Direct input for 'sort' from file 'bar' </dd>
				<dt> ps -ef &gt;&gt; bar2 </dt>
				<dd> Append output of 'ps -ef' to the end of file 'bar2' </dd>
			</dl>
		</body>
	</slide>

	<slide> <title> Shell Globbing </title>
		<body>
			Glob means wildcard matching. Your shell supports a large array of
			wildcard matching. Such wildcards include:

			<p/>

			<dl>
				<dt> * </dt> <dd> Match anything </dd>
				<dt> ? </dt> <dd> Match a single character </dd>
				<dt> {x,y.z} </dt> <dd> Match 'x', 'y', or 'z' </dd>
				<dt> / (trailing) </dt> <dd> Match directories only </dd>
			</dl>

			<font color="red">Globs are expanded BEFORE the command is executed.</font>

		</body>
	</slide>

	<slide> <title> Shell Globbing (cont'd) </title>
		<body>
			Situation:
			<code><![CDATA[nightfall(~/test) % ls -F
a               bar.txt         cc              three/
aa              bb              foo.txt         two/
b               c               one/]]></code>

			Examples of glob usage:

			<dl>
				<dt> echo */ </dt>
				<dd> one/ three/ two/ </dd>
				<dt> echo {a,b}? </dt>
				<dd> aa bb  </dd>
				<dt> ls *.txt </dt>
				<dd> bar.txt         foo.txt </dd>
			</dl>

		</body>
	</slide>

	<slide> <title> Archiving commands </title>
		<body>

			<ul>
				<li> tar - file archiving </li>
				<li> gzip - gnu compression utility </li>
				<li> bzip2 - another compression utility </li>
			</ul>
		</body>
	</slide>

	<slide> <title> tar </title>
		<body>
			<ul>
				<li> tar, the command, is used to create and extract "tar" files. </li>
				<li> tar files are like Zip files, without compression </li>
			</ul>

			Creation: <code> tar -cvf bar.tar.gz file1 file2 file3 directory4 </code>
			Extraction: <code> tar -xvf foo.tar.gz </code>
		</body>
	</slide>

	<slide> <title> gzip/gunzip </title>
		<body>
			gzip is a free compression utility.

			<p/>

			<code><![CDATA[nightfall(~) % du -hs data
1.9M    data
nightfall(~) % gzip data
nightfall(~) % du -hs data.gz
880K    data.gz

nightfall(~) % gunzip data.gz
nightfall(~) % du -hs data
1.9M    data]]></code>

		</body>
	</slide>

	<slide> <title> bzip2/bunzip2</title>
		<body>
			bzip2 is another free compression utility. It often compresses text better than gzip.

			<p/>
			<code><![CDATA[nightfall(~) % du -hs data
1.9M    data
nightfall(~) % bzip2 data
nightfall(~) !1! % du -hs data.bz2 
672K    data.bz2]]> </code>
		</body>
	</slide>

	<slide> <title> What to do with a .tar.gz? </title>
		<body>
			tar often supports a '-z' option to have it automatically gzip/gunzip
			the data before creating or extracting your tar file.

			<code><![CDATA[tar -zcf myfiles.tar.gz mydir/]]></code>

			The same '-z' flag can be used with extraction, '-x'.
		</body>
	</slide>

	<slide> <title> File sizes, quotas, etc </title>
		<body>
			<ul>
				<li> du - disk usage </li>
				<li> quota - display quota information </li>
			</ul>
		</body>
	</slide>

	<slide> <title> du </title>
		<body>
			Display disk space occupied by files and directory contents.

			Usage: <code><![CDATA[du [-hs] [file ...]]]></code>

			<dl>
				<dt> -h </dt>
				<dd> Human readable (mb, kb, gigs, etc) </dd>
				<dt> -s </dt>
				<dd> Report total sum for each of specified files/directories </dd>
			</dl>
			Examples:
			<code><![CDATA[fury(~) % du -hs public_html/
	178M       public_html/]]></code>
		</body>
	</slide>

	<slide> <title> quota </title>
		<body>
			Display quota information.

			Usage: <code><![CDATA[quota [-v]]]></code>

			<dl>
				<dt> -v </dt>
				<dd> verbose output </dd>
			</dl>
			Examples:
			<code><![CDATA[prague% quota -v
Disk quotas for jls9398 (uid 3189):
Filesystem     usage  quota  limit    timeleft  files  quota  limit    timeleft
/home/stu13    40281  40960  40960                  0      0      0            ]]></code>

		</body>
	</slide>

	<slide> <title> Types of quotas </title>
		<body>
			Two types of quotas (limits on space): hard and soft.

			<p/>

			<dl>
				<dt> Soft quota </dt>
				<dd> warnings are issued about being over quota. </dd>
				<dt> Hard quota </dt>
				<dd> New data cannot be written to any files, some programs may fail to work </dd>
			</dl>

			Do NOT go over quota. If you get a message:
			<code>Disc quota exceeded</code>

			This means you are over quota. Being over quota is bad.
			<font color="red">Logging in locally may FAIL if you are over quota </font>

		</body>
	</slide>

	<slide> <title> Keeping under quota </title>
		<body>
			There are many files generated by your actions that you may not need:
			<dl>
				<dt> *.core files (or just 'core') </dt>
				<dd> memory dumps from programs that crashed </dd>
				<dt> *.class files </dt>
				<dd> Class files generated by javac. You may not need these anymore </dd>
				<dt> Firefox web page cache </dt>
				<dd> RIT has a fast net connection. When you're running low on quota, disable or lower your web cache size</dd>
			</dl>
				
		</body>
	</slide>

	<slide> <title> Remote Access (Finally!) </title>
		<body>
			Remote access is obtained to modern systems using SSH over a network connection.

			<p/>

			Ways of logging in using SSH:
			<ul>
				<li> The normal 'ssh' command on any modern unix system </li>
				<li> PuTTY from Windows (free program) </li>
				<li> SSH.com's SSH Client for Windows </li>
				<li> OS X comes with 'ssh' which can be run from any terminal program </li>
			</ul>
		</body>
	</slide>

	<slide> <title> SSH </title> 
		<body>
			ssh is a program that comes with most Unix systems. You use it from the shell.

			<code>ssh username@hostname</code>

			It will ask you for your password. Type it, and you get a shell on the remote host.

			<p/>

			<b>Neat Feature: </b> You can run commands instead of getting a shell:
			<code>ssh username@hostname 'your command'</code>

			Such as:
			<code>ssh jls9398@grace.rit.edu 'uptime'</code>

		</body>
	</slide>

	<slide> <title> PuTTY (Windows) </title>
		<body>
			Download PuTTY from <a
			href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">the
			PuTTY website</a>. 
			<br/>
			(Google for "putty")

			<p/>

			It is very easy to use. Run it, type the hostname, and go. PuTTY acts
			as a terminal AND an ssh client.
		</body>
	</slide>

	<slide> <title> Special Thanks </title>
		<body>
			This workshop would not have been possible without the following people:
			<ul>
				<li> Mike Dumont (CSH) - Planning, scheduling, organization </li>
				<li> Gary Scarborough (IT) - Software and Systems </li>
			</ul>

			Thank you all for attending.
		</body>
	</slide>

	<slide> <title> Questions and Misc </title>
		<body>
			Questions, questions, questions?
			
			<p/>

			I'll be happy to entertain any question 
		</body>
	</slide>

</slideshow>

<!-- 
	vim: foldmarker=<slide>,</slide>
-->
