Geek City:

Unix under the Hood of  the Mac OS X

Peter Roll
Sun City TX Computer Club
Advanced Technology SIG
March 18, 2003


Summary: topics to be covered

Unix ....


1. Where it came from and how it got in under the Mac operating system (a little history...)


2. How it's put together (a little architecture...)


3. How it works (scratching the surface just a little...)


4. What you can do with it
if you're not a Geek:  normal applications software available


5. The Geek's Business Model:
the economics of Unix

6. References

 

 

1. Where it came from and how it got in under the Mac operating system (a little history...)

Why Unix?  What does it do that other PC OS's didn't do (Windows and Mac)?

Pre-emptive multitasking and protected memory: prevents one program or process from interfering with memory utilization of another, thus preventing crashes and simplifying application program design.

Multiprocessor support: allows use of two or more processors by the same task, thus making the computer faster.

Scalability: work the same way on the smallest and largest systems available, with minimum ormaximum feature sets, all sorts of peripherals, protected memory, multiprocessing, threaded processes; from the smallest, most primitive micros to  parallel-processing supercomputers with hundreds of processors.  

Return to Top

 




2. How it's put together (a little architecture...)

... with apologies to the Computer Science profession ...

 


... and with apologies to Apple Computer Corp. ...



Some important characteristics of Unix operating systems:

Return to Top




3. How it works (scratching the surface just a little...)

a. Important notes:
 

 

b. Anatomy of a Terminal window, on opening (login):

 

Last login: Sun Mar 16 15:03:06 on ttyp1
Welcome to
Darwin!
[Peter-Rolls-Computer:~] proll%

Date, time, device
Welcome
[Name of computer: active directory] username

 

c. Some definitions:

Unix directory

a folder in Mac or Windows lingo

Active directory

the one that all the action will take place in at any given time

root directory

at the root or top level of the hard disk

root directory

/

active user account home directory

~

pathnames in the file

 

full pathname, e.g.

/Users/proll/Documents

pathname relative to active directory

/Documents

pathname relative to active user home directory

~/Documents

down one level in file system hierarchy

/dirname

up one level in the file system hierarchy (parent directory)

../

change active directory command

cd pathname (note the space as a delimiter!)

 


d. The Unix File system

The file system under Mac OS X (column view, similar to Windows Explorer -- shows  relative position of files and folders):





The actual file structure under Unix contains much more at the root level than is shown in the OSX finder!

[Peter-Rolls-Computer:~] proll% ls
100NIKON            Documents           Music               Send Registration
Applications        Library             Pictures            Sites
Desktop             Movies              Public
[Peter-Rolls-Computer:~] proll%
[Peter-Rolls-Computer:~] proll% cd /
[Peter-Rolls-Computer:/] proll% ls
???Move&Rename            System                    etc
AppleShare PDS            TheVolumeSettingsFolder   mach
Applications              Trash                     mach.sym
Desktop DB                Users                     mach_kernel
Desktop DF                Volumes                   private
Desktop Folder            automount                 sbin
Library                   bin                       tmp
Network                   cores                     usr
Resources                 dev                       var
[Peter-Rolls-Computer:/] proll% cd ~/documents
[Peter-Rolls-Computer:~/documents] proll% cd ~/Documents
[Peter-Rolls-Computer:~/Documents] proll% ls
8:27:02Apps.10.1.5.tiff                 Neighborhod#2.lst
ACO                                     Neighborhood 2 DIR-2
Acrobat User Data                       Neighborhood 2 Dir
AppleWorks User Data                    NewBookmarks.html
BackupStuff                             NewBookmarks.html~
CD-RWSuppt.rtf                          Notes
CompClub                                OSXInfo
ComputerIcons.cwk                       OnlineOrders
DVixDir.rtfd                            PIE.SCGT
Email file (generic) #13726             Palm
Eudora Folder                           Palmcopy020205
FAXReceive                              Personal:Family
FloorPlan0211.gif                       Peter.fs
GCN                                     Quintet
GISDTechn.Cte                           RouterRef1.rtf
GIVE                                    SchoolTaxDoc98.01
Gtwn+                                   Science
IDs.rtf                                 ServicesReadMes
IDsMaster.rtf                           ShowCase030218a.tiff
ISPFAQ                                  SrUniv
InstallFiles                            TB2MsgsRcvd
InventoryTempl.sylk                     WebSites
JohnsExcel                              WoodShop
MAIN                                    eGtwn
MacNews0201.rtf                         emailadrses030102.bk
Microsoft User Data                     iNotePad User Data
MiscRecFiles                            index3.html
Move:Retirement.95
[Peter-Rolls-Computer:~/Documents] proll%


What's found in this Terminal window:

Some notes on the File system, Unix and OS X:

 /Users/proll/documents/Compclub
is the full path to my Computer Club folder; and that

~/Documents/Compclub
is exactly the same path.

All info for a given user (settings, documents, etc.) is stored in the User Account Home directory (or folder) (similar to the Documents and Settings folder in Windows XP).
In the directory /Users/proll/ (same as ~/)

Applications available for use by all user accounts are stored  in the root /Applications  directory-folder

Appllications available for use only by a given user are stored within the user's home directory-folder, ~/Applications

Return to Top



e. A few of the Unix Services:


(1) The Unix Shell: the tcsh shell is default for OS X

(2) Some shell commands (Unix utility programs):

General format of shell commands:  commandname options arguments

·             Note that the spaces are essential delimiters

·             options are of the format -x, where x is a code letter for an option

How do you find out what the commands do and what the options are?

·             type the command man commandname

·             this displays the Unix manual page for the specified command -- try it!

(3) Some commands or services we've already seen (above):

·         ls

·         cd

·         man

·         ls -la (list showing details (l) and hidden files (a))

 

Last login: Sun Mar 16 16:33:30 on ttyp1
Welcome to
Darwin!
[Peter-Rolls-Computer:~] proll% cd /
[Peter-Rolls-Computer:/] proll% ls
???Move&Rename            System                    etc
AppleShare PDS            TheVolumeSettingsFolder   mach
Applications              Trash                     mach.sym
Desktop DB                Users                     mach_kernel
Desktop DF                Volumes                   private
Desktop Folder            automount                 sbin
Library                   bin                       tmp
Network                   cores                     usr
Resources                 dev                       var
[Peter-Rolls-Computer:/] proll% ls -la
total 11273
drwxr-xr-x   2 proll  unknown       68 Jan  2 17:01 ???Move&Rename
drwxr-xr-x  34 proll  staff       1156 Mar 16
14:37 .
drwxr-xr-x  34 proll  staff       1156 Mar 16
14:37 ..
-rwxr-xr-x   1 proll  staff      12292 Mar 16 14:37 .DS_Store
d-wx-wx-wx   3 root   unknown      102 Sep  2  2002 .Trashes
-r--r--r--   1 root   wheel        156 Jul 14  2002 .hidden
dr--r--r--   2 root   wheel        160 Mar 16 11:21 .vol
-rwxr-xr-x   1 proll  unknown   323584 Feb 27 02:35 AppleShare PDS
drwxrwxr-x  53 root   admin       1802 Feb 26 20:14 Applications
-rw-r--r--   1 root   admin     119296 Mar 16 13:36 Desktop DB
-rw-r--r--   1 root   admin     841458 Mar 15 10:21 Desktop DF
drwxr-xr-x   2 proll  unknown       68 Dec 20 21:51 Desktop Folder
drwxrwxr-x  32 root   admin       1088 Feb 27 20:42 Library
drwxr-xr-x   6 root   wheel        204 Aug 31  2002 Network
drwxr-xr-x   4 root   staff        136 Mar 14 14:03 Resources
drwxr-xr-x   4 root   wheel        136 Dec 15 03:07 System
drwxr-xr-x   3 proll  unknown      102 Dec 20 21:51 TheVolumeSettingsFolder
drwxr-xr-x   2 proll  unknown       68 Dec 20 21:51 Trash
drwxrwxr-t   5 root   wheel        170 Aug 31  2002 Users
drwxrwxrwt   5 root   wheel        170 Mar 16 11:21 Volumes
dr-xr-xr-x   1 root   wheel        512 Mar 16 17:08 automount
drwxr-xr-x  35 root   wheel       1190 Jan 25 12:19 bin
drwxrwxrwt   2 root   wheel         68 Jul 14  2002 cores
dr-xr-xr-x   2 root   wheel        512 Mar 16 11:21 dev
lrwxr-xr-x   1 proll  staff         11 Mar 16 14:37 etc -> private/etc
lrwxr-xr-x   1 proll  staff          9 Mar 16 14:37 mach -> /mach.sym
-r--r--r--   1 root   staff     706480 Mar 16 11:21 mach.sym
-rw-r--r--   1 root   wheel    3733424 Dec 14 05:11 mach_kernel
drwxr-xr-x   6 root   wheel        204 Mar 16 11:21 private
drwxr-xr-x  60 root   wheel       2040 Jan 25 12:19 sbin
lrwxr-xr-x   1 proll  staff         11 Mar 16 14:37 tmp -> private/tmp
drwxr-xr-x  10 proll  staff        340 Mar 14 14:03 usr
lrwxr-xr-x   1 proll  staff         11 Mar 16 14:37 var -> private/var
[Peter-Rolls-Computer:/] proll% 

 


Some other useful commands:


Finding things on your hard disk:   locate pattern

Printing and Piping:

enscript filename: converts a file to postscript for printing to a postscript printer (most laser printers)
atprint filename: prints a file to an AppleTalk printer; this command must be set up first with the commands

If the AppleTalk printer is a postscript printer, then you must convert it to postscript before sending to the printer. The way to do this is to Unix's piping capability:  the pipe symbol | will pipe the output of one command into the input of the next; e.g., to print the manual page for the locate command,

man locate | enscript | atprint



Shell scripting, aka shell programming: the Unix alias:

 

[Peter-Rolls-Computer:~] proll% ls
100NIKON            Documents           Music               Send Registration
Applications        Library             Pictures            Sites
Desktop             Movies              Public
[Peter-Rolls-Computer:~] proll% alias ls "/bin/ls -al"
[Peter-Rolls-Computer:~] proll% ls
total 56
drwxr-xr-x  17 proll  staff    578 Mar 16
14:37 .
drwxrwxr-t   5 root   wheel    170
Aug 31  2002 ..
-rw-r--r--   1 proll  staff      3 Dec 26 20:28 .CFUserTextEncoding
-rwxr-xr-x   1 proll  staff  12292 Mar 16 14:37 .DS_Store
drwx------  13 proll  staff    442 Mar 16 13:55 .Trash
-rw-r--r--   1 proll  staff     31 Mar 13 12:09 .lpoptions
drwxrwxrwx  10 proll  staff    340 Dec 21 07:25 100NIKON
drwxr-xr-x   3 proll  staff    102 Sep  3  2002 Applications
drwx------  23 proll  staff    782 Mar 16 14:37 Desktop
drwx------  59 proll  staff   2006 Mar 15 22:05 Documents
drwx------  39 proll  staff   1326 Feb  5 21:25 Library
drwx------   4 proll  staff    136 Jan 18 18:54 Movies
drwx------   7 proll  staff    238 Dec 18 13:03 Music
drwx------  20 proll  staff    680 Mar 15 17:35 Pictures
drwxr-xr-x   4 proll  staff    136 Aug 31  2002 Public
lrwxr-xr-x   1 proll  staff     55 Mar 16 14:37 Send Registration -> /Users/proll/Library/Assistants/Send Registration.setup
drwxr-xr-x   5 proll  staff    170 Aug 31  2002 Sites

 

Aliases can be saved to the /bin/.cshrc text file so that they will always be active. An alias is a little shell program; you can construct some very complex programs this way!!

Return to Top

 



4. What you can do with Unix if you're not a Geek:  normal applications software available


MS Office replacements:

Browsers:

Utilities:  thousands  of these

One example:  CarbonCopyCloner, by Mike Bombich

The Good News: thousands of programs available at no cost, downloadable
The Bad News:  most of them are designed for other Geeks, rather than ordinary users,
but if there's something usable for just about every purpose if you are willing to look and tolerate a little geekiness.

Return to Top

 



5. The Geek's Business Model: the economics of Unix


The open-source movement
-- an integral part of Unix:

From the Apple Darwin FAQ page:  

Q. What is open source?
Open source is a term for the historical development model used by the Internet community to facilitate distributed development of complex, high-quality software. The basic principle is to involve as many people as possible in writing and debugging code, by publishing the source code and encouraging the formation of a large community of developers who will submit modifications and enhancements. Community efforts such as BSD, Linux, Sendmail, Apache, and Perl embody the spirit and power of the open source model.

Q. Why is Apple opening up its source?
We believe the open source model is the most effective form of development for certain types of software. By pooling expertise with the open source development community, we expect to improve the quality, performance and feature set of our software.
Secondly, we realize many developers enjoy working with open source software, and we want to provide them the opportunity to use that kind of environment while delivering solutions for Apple customers.

The open-source movement is

The results of this information and  communications revolution and the surviving business and economic models will become clear only after decades of evolution -- not in our lifetime.  

What better name than
Darwin for an operating system that grew out of the beginnings of this revolution?  

 


Return to Top


6. A Few References: Unix under Mac OS X

Taylor and Peek, Learining Unix for Mac OS X; O'Reilly, Sebastopol, CA, 2002; 126 pgs.

O'Reilly
is the definitive publisher of reference and textbooks on alll varieties of the Unix OS; see their website for many more useful references

Listing of  Unix & Open-Source programs that will run on OSX Macs: http://www.apple.com/downloads/macosx/unix_open_source/

Apple's Open-source Darwin home page; explains briefly the concept behind Apple's open-source approach and the architecture underneath OSX:  http://developer.apple.com/darwin/

The Fink Project " ...  bringing the full world of Unix Open Source software to Darwin and Mac OS X . We modify Unix software so that it compiles and runs on Mac OS X ("port" it) and make it available for download as a coherent distribution. Fink uses Debian tools like dpkg and apt-get to provide powerful binary package management. You can choose whether you want to download precompiled binary packages or build everything from source."  http://fink.sourceforge.net/

SourceForge.net:  " ... the world's largest Open Source software development website, with the largest repository of Open Source code and applications available on the Internet. SourceForge.net provides free services to Open Source developers."  http://sourceforge.net/


Return to Top