Getting to Cunix |
To get into Cunix, the computer you're working on needs to
be set up with an SSH client. $ ssh yourUNI@cunix.cc.columbia.edu Type in your password when Cunix requests it. More information about using Mac Terminal to connect to Cunix can be found here. Windows users need to download PuTTY. CUIT maintains a copy of PuTTY that is pre-configured to connect to Cunix. You can download it here, with further instructions here. |
Editors | |||||||||||||||||||||||||||
Emacs | |||||||||||||||||||||||||||
Emacs is an extremely versatile text-editor, and is particularly good for programming. Emacs provides modes for various programming languages which allow for context sensitive indentation and layout, and allow you to compile your programs inside Emacs, with links from error messages to source code. It even has spell checking and a Rogerian therapist included! To start Emacs, at the command prompt type: $ emacs Or, to work with a particular file type: $ emacs filename If you're using Emacs from within your shell (which you are at this point), you need to know these basic key-stroke-combinations. Here a "C-x" means "hold the Control key down while you hit the x key".
More useful emacs commands can be found here: http://www.columbia.edu/acis/publications/emacs.html |
|||||||||||||||||||||||||||
Pico | |||||||||||||||||||||||||||
Pico stands for PINE composer, and is the text editor used by the email client PINE (a Program for Internet News & Email). Pico is easy to use, since it always displays a menu of commands at the bottom of the screen, but does not have the programming specific features of emacs. You can open pico by typing either of: $ pico (opens a blank file) Here are some common pico commands (the ^ stands for the Control key):
You can find more information about Pico commands here http://www.columbia.edu/acis/publications/pico.html | |||||||||||||||||||||||||||
Vi | |||||||||||||||||||||||||||
The Vi editor has powerful features to aid programmers, but many emacs devotees avoid Vi at all costs. * The Vi editor has two modes: command and insert. The command mode allows the entry of commands to manipulate text. The insert mode puts anything typed on the keyboard into the current file. Vi initially starts in command mode. Open a file in Vi by typing either of: $ vi (opens a blank file) Here are some basic Vi commands:
For more information on VI visit this tutorial: http://www.eng.hawaii.edu/Tutor/vi.html * Read more about the Emacs/Vi schism here: Vi vs. Emacs |
X-Windows |
X-Windows is a windowing system used almost exclusively on Unix platforms. X-Windows allow commands executed on a remote machine (i.e. the Cunix cluster), to display graphical information on your local machine (i.e. the workstation you're sitting at). With X-Windows, an X-server controls the display directly, and is responsible for all input/output via the keyboard, mouse or display. X-clients do not access the screen directly, but communicate with the server and do the actual 'work' of running applications.
To use X-Windows with Cunix you need an X-server. All
of the AcIS lab machines already have X-servers
installed. If you need an X-Server for your home
computer you can download one free from:
$ssh -X username@cunix.cc.columbia.edu Step 1: Start your X-server For AcIS Sun workstations in 251 Mudd: you already have an X-server running. Skip to step two.
Step 2: Tell the remote machine (Cunix) where you want it to display programs. This is done by setting you display environment variable ($DISPLAY) to the name of your local machine. First, find out what machine you're on. To do this type: $ who am i The last field of output (in parentheses) should be your machine, or hostname. Now, using this hostname, type: $ export DISPLAY=hostname:0.0 [note: if you're using the C-shell (csh) use this line instead: 'setenv DISPLAY hostname:0.0' If you don't know what the C-shell is, you are most likely using the bash shell, which is the default for Cunix users] Step 3: Tell your local machine that it's ok for another computer to open applications on your display. For AcIS Sun workstations in 251 Mudd: Open an X-term window (the X-term icon is located at the bottom of the screen) and type: $ xhostFor all other machines: This step should not be necessary. A note about xhost: Typing "xhost +" allows all other computers to connect and start applications on your display. "xhost -" removes that privilege. "xhost +machine_name" allows you to specify the machine to which you wish to grant X access. Step 4: You're ready to open up an application. For example try: $ emacs filenameTo regain use of your shell while emacs is running, instead type: $ emacs filename &The '&' allows emacs to run as a background process. Note: You may not be able to run X sessions if you are behind a firewall. One of the best reasons to use the X-Windows version of Emacs is for the text color coding. (We used this feature in class.) Variable names, class names and other special parts of your program are given different colors, so it is easy to navigate around your code and spot typing errors without even compiling. The name of this Emacs feature is font lock mode. To turn it on in graphical (X-Windows) Emacs, type Meta-Xwhere the "Meta" key is the Escape key. Hit Meta first, then X. Emacs should bring the cursor down to a line at the bottom of the screen that begins with M-x. Here, Emacs waiting for you to finish your command. Type: M-X global-font-lock-modeand Emacs will properly fill in the colors for your code file. Note that this only works if your code is in a file with the proper name extension (i.e., ending in .c, which is how Emacs knows which color-coding scheme to use). |
Your .profile |
Your .profile is a file in your home directory that configures your environment when you log in to Cunix. There are many useful settings you can put in your .profile, and here we will see just a few. In Unix, your environment is defined by a set of environment variables which can be set by including a line like 'export VARIABLENAME=value' in your .profile. [Note that if you're using the C-shell, use the file .login rather than .profile, and set varables with the line 'setenv VARIABLENAME value'].
To change your environment settings, you will need to
edit your .profile (in emacs,
pico, or vi).
$ ~/.profile   (or $ source ~/.profile) This command forces the .profile to be executed or 'sourced', even though you have not logged in again. Note that any command or environment variables in your .profile can also be used on the command line (and vice versa), Variables set on the command line will only remain set for the life of the shell in which they are entered, while those entered in the .profile are set each time you log in to a new shell. |
Other useful additions to your .profile |
Changing your prompt
To change your prompt, use the $PS1 environment variable, but including a line like this in your .profile:Setting your TERM typeexport PS1='this is my new prompt! :)'Recalling the commands from the beginning of this tutorial, can you guess what this prompt will look like?export PS1='$PWD>' Sometimes Unix programs that need to display information in your shell get all funky and messed up, seemingly for no reason. This happens especially when you're using a terminal (i.e. telnet program) on a PC. Different terminals use different control sequences to move the cursor around and change the display in your shell. The $TERM environment variable is used to communicate this information to emacs and to other Unix utilities. Since almost all terminal emulation software for PC's have a vt100 emulation mode, you can often fix the problem by typing at the command prompt:Aliasesexport TERM=vt100or better yet, adding it to your .profile so it's always set. An alias, as the name suggests, assigns an assumed or additional name to a given command. Aliasing long, frequently typed, commands can make your life a lot easier. To set an alias, type alias newname='old command'. These are some recommended aliases to keep your files safe:alias rm='rm -i' You can find some more common environment variables here: http://www.columbia.edu/acis/tutor/Unixhelp/tables_env_list.html |
SFTP: Secure File Transfer Protocol |
SFTP allows you to transfer files between your local PC or Mac and Cunix (on the Suns there is no real 'local' file storage, so this is not necessary). An SFTP program will prompt you for your Cunix username and password, and then will give you access to transfer your Cunix files. The two needed commands for SFTP are: get -- transfer file from remote machine (i.e. Cunix) to local machine (i.e. your computer) There are a few different methods for using SFTP:
|
SFTP Software |
On the AcIS PCs, a program called WIN-SCP provides
a fairly intuitive graphical user interface for
transferring files.
On the AcIS Macs, a program called Fugu is
similarly user friendly. (Note: chose Raw
Data when given the transfer method option)
|
SFTP Through a Web Browser |
This is a popular method because it is portable across all operating systems, and allows you to drag and drop your files. In your browser's url field type: sftp://username@cunix.cc.columbia.edu (substituting your username)
Notes: |
Command line SFTP |
On a PC, open a command (DOS) prompt, navigate to the
desired directory using cd and
dir (the equivalent of Unix ls), and type:
> sftp cunix.cc.columbia.edu Or, alternatively type: sftp open cunix.cc.columbia.edu If you are transferring any files that are not plain ascii text (i.e. executable programs, word docs, etc), you will want to make sure you're in binary mode. Before you transfer any files type: sftp> bin You can navigate through your Cunix home directory, using the cd and ls commands. You will not be able to use tab-completion here. Use the get and put commands as described above like this: sftp> get cunixfile To exit, type: sftp> quit This method will also work when transferring files between two Unix systems. |
Printing |
To print to an AcIS printer use this command: $ lpr -Pprinter_name filename A full list of AcIS printer names (called Lpr server) and locations can be found here: http://www.columbia.edu/acis/facilities/printers/locations.html Print quotas: Students with extended accounts get 100 pages per week. To check how many pages you have remaining in your quota type: $ pages Or, for more detailed information: $ pages -v To check what type of account you have, type: $ groups Your primary group is the first group that appears in the list. If this is student, then you have an extended account.
Find out more about account types and print quotas here
http://www.columbia.edu/acis/facilities/printers/quota.html
|
Columbia Computer Labs | |||||||||||||||||||||||||
Your Cunix account allows you to use the AcIS computer labs on campus: 251 Mudd and 213 Butler. These public labs are staffed with consultants that can assist you with non-homework related problems. 251 Mudd has both Solaris and Windows machines and is the best choice for coding; it usually has free machines (note: Sun workstations require an extended account). 213 Butler has mostly Windows PCs and some PowerMacs. 213 Butler is usually crowded. These are the current public lab hours:
Residence hall clusters and other electronic classrooms are un-staffed. In addition there are some electronic classrooms such as 407 Mathematics that are sometimes free for student use. For more information about AcIS lab facilities see: http://www.columbia.edu/acis/facilities/labs/locations/ |