Tomorrow



Tomorrow, I am going to give an hour presentation about the Mac OS X command line to the San Francisco chapter of the Apple Consultants Network.

My feeling about any presentation, is that the listener will get more out of the presentation, if he has done a little bit of homework before the presentation. So here's ten minutes of homework to get you ready for the meeting tomorrow.

I know that some of you are command line wizards and that you know more than I know.

There are others of you, who may have never done a

$ ls -l



Homework



1) Please add 3 standard users to your system. Using the GUI, go to System Preferences --> Accounts, and add 3 standard users. For my demo tomorrow, my 3 users will be teacher, student1, and student2.

2) Launch the terminal application. Go to Applications --> Utilities --> Terminal

3) Change to the Documents folder and then create a folder 20090205

$ cd Documents

$ mkdir 20090205

4) We want to be able to make a plain text file. Some of you, probably already know vi, bbedit, emacs, or another program to make a plain text file. In order to put everyone on the same page, or so you can help someone else tomorrow, please experiment with the nano editor.

5) Using the nano editor,

For instructions about the nano editor see:

http://www.uic.edu/depts/accc/software/pine/pico.html

(The nano editor is an open source version of the pico editor. If you type pico, then you actually get the nano editor.)

a) create a file named 123.txt
$ nano 123.txt

b) Put only the 3 characters, 1, 2, and 3 into the file.

c) Save and exit the program.

d) Using ls -l , verify that 123.txt is only 3 bytes long. If it is 4 bytes long, try to figure out what happened.

e) Look at 123.txt with the command
od -c 123.txt

f) If 123.txt is 4 bytes long, try again with
$ mv 123.txt 123firsttry.txt
$ nano -L 123.txt

g) Now use ls -l
Do you now only see 3 bytes?

h) od -c 123.txt

i) repeat f, g, and h until you can only the 3 characters 1, 2, and 3 into a 3 byte file.

j) cp 123.txt 123456.txt
Using the nano editor add the character 4, 5, and 6 to the file.
$ nano -L 123456.txt

h) Using ls -l, verify that 123456.txt is only 6 bytes long.

i) Look at 123456.txt with od -c
$od -c 123456.txt

j) cat 123.txt

k) cat 123456.txt

m) cat 123firsttry.txt

that's the end of the homework. For extra credit, you might want to think about the following things:

Extra Credit : Things to think about before tomorrow



What is /Users/teacher/Public used for?

What is /Users/teacher/Public/Drop Box used for?

Can student1 leave a file in /Users/teacher/Public ?

Can student1 leave a file in /Users/teacher/Drop Box ?

Can student1 modify a file in /Users/teacher/Drop Box?

Can studentt1 execute a file in /Users/teacher/Drop Box?

Can student1 delete a file in /Users/teacher/Drop Box?

Can student1 list the files in /Users/teacher/Drop Box?

How does the teacher know that a student dropped something into his Drop Box?

What is the difference creating a file with TextEdit or with nano?

What is a data fork?

What is a resource fork?

What is metadata?

In Mail.app, there is an option of sending an Attachment or sending a Windows Friendly Attachment. What is the difference?

How would you test your answer to the previous question?

Using grep, | (pipe), and wc can you:



tell how many emails you have posted to the ACN Tech list?

tell how many emails I have posted to the ACN Tech list?

Name 3 scripting languages.

Using a scripting language, can you write a program that will show how many emails each member has posted to the ACN tech list?

How to use the command line to solve network problems



A Mac consultant arrives in a classroom that a wireless network. The network consists only of Windows Dell PCs and 1 very old pre-bonjour pre-rendezvous HP Laserjet 4 printer. The Laser printer is working fine.

The teacher gives you the SSID and password of the wireless network, so that you can get on the network. Once you MacBook successfully connects to the wireless network, how do you, using only the terminal utility:

1) determine your own IP address

2) determine the IP address of the HP Laserjet 4 printer

3) determine what ISP the school is using

ftp, sftp, ssh, and scp




Using ssh , login to your own machine. Approximately, how many non GUI command line programs do you see?
Approximately, how many GUI applications do you see?

ftp into your own machine. What is the difference between an ascii transfer and a binary transfer?

Using ssh, can you generally log into a Mac OS X machine and get a fortune cookie?

Using ssh, can you generally log into a Linux machine and get a fortune cookie?


Even more information


Thanks to whoever was in the front row and suggested, looking at the Mac OS X Unix tutorial at:
http://www.osxfaq.com/Tutorials/LearningCenter/index.ws