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

Command line interpreter (Shell)

FinderTerminal utilityOpen 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)

When you're finished with a terminal session you should exit to see if you still have anything running under your shell, and then close the terminal window.

Getting around the filesystem

Bash - ls commandBash 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.

more [filename]. Shows you the contents of a file. You need to know 3 commands to use more:

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

When using man, you use the same 3 keys ([space], b,q) as more to move around in the man pages.

More tips and resources

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

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.