POSSIBLY THE LAST X-LAB... 9 and 10 are OPTIONAL

1.  Log on to your linux machine.

2.  Among the many fun things you can do with your unix shell, you can play with your
	history, aliases, and .login script.  These we will take in order.

	Try history.  If it doesn't come up with much, let's do something
	interesting first.  Populate your directory with files named
	1, 2, ...., 10 by redirecting date to each, e.g.

		date > 1

		date > 2

	etc.

	You should have 10 such files, which you can verify by listing

		ls

	and by catting,

		cat 3

	and even more interesting should be your history now.o

	Say history.  Sometimes we say history | tail if we are not very
	interested in very old commands.

3.  It would be even more interesting if you said

		date >> 1
		cat 1

	and extended the file.  Now do history.  See your last two commands?
	Suppose they are commands 31 and 32.  Now say

		!31
		!32

	We call those "bang 31" and "bang 32" because "exclamation 31" is a mouthful.

	Did you like that?

	Try repeating other commands in your command history.

4.  Most people just recall their past commands with letters, and you can say

		!d
		!c

	But there might be some risk if you can't remember what your last
	d-command was.  So you'd be safer with:

		!date
		!cat

	or even

		!date; !cat

	and now

		!date

	is the compound command.  Ha ha ha ha.  A monster have created I.

	!! does the last command.  Be careful when you do this.

5.  Humor me.  Try 

		date >> 1

	Now 
	
		^1^2

	...yeah, that's carat followed by a string, then carat followed by
	the replacement string.  That should do the last command except substitute
	2 for 1.  

6.  You should try the command 

		alias

	from which you will see that people have aliased some commands for
	you.  They probably have aliased rm, mv, and cp because they don't
	trust you.  If you want your cp back to normal, for example you
	can say 
	
		unalias cp

	etc.

	But if you don't trust yourself, say

		alias cp "cp -i"

	and it will be back to the baby form of cp which has the -i option
	for interactive (it asks you if you want to clobber an existing file).

	Try alias some commands, e.g.

		alias foo date

	or

		alias harumph "history | tail -3"

	... and try out your aliases.

	FAN-tastic.

7.  You can put your aliases in a permanent place by adding them to the
	end of your .login file.  Say

		vi .login

	and shift-G to go to the bottom, then o to open a new line.

	Add a few lines of aliases, and for good measure, add a line like:

		echo "adding aliases"

	before, and add a line like:

		echo "done adding aliases:

	after your alias commands.

	Now log out and log back in.  Try the command

		alias

	and

		harumph

	and see if it works.

8.  As long as you are playing with the .login script, add

		date
		cal
		w
		quota
		from

	to your .login so that every time you log in, it reports
	the status of your account and the machine.

	Hey, you might even add something like

		printenv | egrep 'OSTYPE|MACHTYPE|TERM|HOST|STATION'

	which will really clue you in, when you log in.

9.  You could add some commands to your .logout script, too,
	but there's not as much you want to do whey you log out.

	How about:

		rm /tmp/*

	since you really shouldn't leave any files in /tmp that you own.
	But if some poor user accidentally gave you write privileges,
	that command would wipe out that user's files, too.  And you
	probably don't want to put rm and star in too many unsupervised
	lines of code -- we all make mistakes.

	Maybe you want to check your mail one last time before logging out.

	Put

		mail

	or

		pine

	in your .logout file and this will make you enter the mail program
	before logging out.

	Try it.  The way to logout is to say

		logout

	or 

		exit

	When you exit the mail program, the logout will complete and you
	will be logged out.  It's a strange feeling -- goodnight irene -- but
	kind of neat, too.

10.  Since there aren't a lot of students in X, this might be your last lab.
	We'll see if others can make it this far.  If not, I am happy to
	just show UNIX command sequences during lab times to any student
	who finishes these 8 labs early.