------------------------------------------------------------------------------
MC logo
Get Some Unix
[^] CSc 422 Assignment 1
------------------------------------------------------------------------------
[CSc 422 Assignment 1] [CSc 422 Assignment 2] [CSc 422 Assignment 3] [CSc 422 Assignment 4]
[Get Some Unix] [Using Emacs on Sandbox]

To get access to a Unix-like environment, you can install one yourself, or use ours on Sandbox.

If you have a Mac, OS X is built atop a derivative of BSD Unix, so all you should have to do is install a few tools. But since I don't have a Mac, I can't do much more than refer you to Google. You will need to find out how to run the command shell, and you will need to install the gcc compiler.

The best bet may be to install one of the many Linux distributions on your own computer. My favorite is Fedora. Other popular distributions are Ubuntu and Mint. Puppy Linux is a distribution designed for small. Knoppix is a distro that can be burned to a bootable DVD or flash. When running, it can also install itself on a flash in an arrangement which allows you to permanently store files (difficult on a CD-ROM). Linux can be installed beside an existing operating system to allow dual boot, where you can select which O/S to run at boot time. Some ways to do this:

Or you can just use our Sandbox server over the Internet. To connect from Windows, you will want to download putty. This will let you use the command line remotely to edit and run files. You can Google any number of Unix tutorials, and there is a small list of commands below. From Mac, do this.

You may also want a copy of the WinSCP program (Windows only) which can copy files to and from the Sandbox server. (Use SCP or SFTP for transfers. Do not use FTP.) WinSCP can also be used to edit Sandbox files in a windows on your desktop.

You will need to edit files on Sandbox. There are several options

Some Unix Commands

Here are a few Unix commands which you may find useful if you are running on Sandbox or on your own system. Consult your favorite search engine for any number of more comprehensive tutorials.
logout

This is how you end a remote connection to Sandbox or another server. (You probably won't use it much if you have your own.)

ls

This lists all the files in the current directory. It is like the DOS dir command.

mkdir

This creates a new directory. Say mkdir dirname to create a new directory named UT_(dirname). Directories are the same thing as folders in Windows terminology.

cd

The command shell always operates in some “current directory”. Initially, it is your home directory. Commands generally apply to files in the current directory.* To change the current directory, to UT_(dir), say cd dir. Commands will now operate on files there. If the UT_(dir) is .., the cd command will move to the parent directory.

rm

This deletes files; say rm fn to delete the file named UT_(fn). The name stands for “remove”.

script

The script command places a script of your session into a file, which you can then edit or print. Everything you type, and everything the computer types, exactly as it appears on the screen, is placed into the file. To use it, just say script, and you will get a message and your prompt back, as:

[bennet@sandbox test]$ script
Script started, file is typescript
[bennet@sandbox test]$ 

Now, everything that happens is recorded in the file typescript. Recording ends when you give the command exit.

[bennet@sandbox test]$ exit
[bennet@sandbox test]$ Script done, file is typescript
[bennet@sandbox test]$ 

(Note that the “Script done...” line was typed by the computer. It is not a command). You can now examine typescript with any text editor, or print it. You should not try to work with the typescript file until you have given the exit command.

man
man -k
apropos

The man command documents other commands. Say man command to get information about UT_(command). To find out what commands might be available, you can try man -k topic, and you will get a list of commands related to the UT_(topic). Apropos is the same as man -k.

info

The info command is the Free Software Foundation's documentation tool. Not every command or program is documented here, but many are, and the documentation is usually quite thorough, including everything you could ever possibly want to know about emacs or gcc. Say info to reach the main topic menu. Say info info for help using the info program itself.

gcc
g++

This is the command to run the compiler, gcc for plain C, or g++ for C++. You can compile a program by giving it on the command line, like g++ pgm.cpp. This will place the executable in a file called a.out, which can be run by typing a.out (or ./a.out may be required depending on the system configuration). If you would like to give the executable a less-stupid name, you can use the -o option to give the name. For instance, g++ -o pgm pgm.cpp to create pgm.

make

The make program is the standard way to build software under Unix. If you have a single-file program, such as pgm.cpp, you can say simply make pgm, and make will compile it to the executable pgm. For a more complex build, you will need to create a Makefile, which is a rather large topic.



* Unless the file is given by full name, starting with a slash, like /home/smith/Downloads/dingbat.zip.
The .. convention generally refers to the parent directory, and also exists in URLs. The web was invented by Unix-heads.