Unix
Both the Linux OS (www.goshen.edu) and Mac's OS-X are flavors of the Unix operating system.
Readings
Work through the emacs tutorial (emacs, then [ctrl]-h, t)
40 years and counting
- Unix was first developed in 1969 at AT&T Bell Labs (but not initially with any financial support).
- First operating system to be written in a high-level language (C) instead of machine code.
- Since AT&T made the source code available to academic institutions, it was widely studied.
- Ported to more systems than any other OS--most often the foundation of "open systems".
Command line interpreter (Shell)
![]()
Open
up the Mac 'Finder'. Find the Terminal utility - under "Applications > Utility".
Drag it to your system tray and drop it.
Double-click Terminal and you'll find yourself running a command line interpreter (or "shell") called Bash ('Bourne Again SHell)
exit to see if you still have anything running under your shell, and then close the terminal window.
Getting around the filesystem
Bash is a classic example of a user interface (UI) for
experts.
ls - 'list' all the files in the current directory (pwd), also ls -l, ls Desktop
Notice that when you first start up Bash on a Unix system you are connected to your home directory. On a Mac this is something like /Users/[your username]. On a Linux system it might be /home/[your username].
/ is the 'root' of the filesystem. Try ls /
ls - 'list' all the files in the current directory,
also ls -l, ls Desktop
pwd - 'print working directory', what directory
am I in presently?
cd Desktop - 'change directory'. Also, cd .. to go 'up' one level, and just cd with no argument to return to your home directory from anywhere.
Unix manual pages
There is reference information available for most Unix commands in the man pages. This command displays the manual information for the pwd command:
man pwd
You need to know 3 commands to use the man pages:
[space] - advances the text one page,b - go back one page,q - quit the man page display.
Emacs
Now, we'd like to start working with files, particularly human readable text files. Unix comes with many text file editors, including vi, joe, pico. We'll teach emacs - a well tested (V.23.x) editor that also lets you customize and extend it with 'macros' when you're ready to do that.
Start up emacs without a file name to see help:
emacs
Then hit [ctrl]-h, t to get the tutorial which you should work through.
Emacs: Getting around
emacs hello.html
[ctrl]-x [ctrl]-c: leave the editor.[ctrl]-x [ctrl]-s: save the file without leaving emacs.[ctrl]-a, [ctrl]-e: go to the beginning or end of a line (also works for bash command line editing!)- The arrow keys will move you around a character, or line at a time.
[ctrl]-v, [esc] v: advance (or go back) by one screen[ctrl]-s, [ctrl]-r: search forward for some text, or reverse search for some text.
More emacs practice
On the next page on html we'll use emacs to start messing around with web pages. There are also more tips on using emacs and shell commands.
See also: Gnu Emacs Manual.