Before you read this guide, you should read About Your CLAC account to understand what your account should be used for, and how to troubleshoot login issues. This guide will show you how to set up your programming environment so that you are ready to do assignments for this course.
If you are not familiar with using the command-line, you should look beyond this guide to learn about the Linux/UNIX programming environment. In addition to the course’s lecture notes, there are many books and online resources you can use. For example, here is the top link that came up when I googled for “linux tutorial for beginners”: http://www.ee.surrey.ac.uk/Teaching/Unix/.
You will log in to CLAC on the command line using SSH. SSH allows for you to start a secure terminal session with a remote host or server, or CLAC in our case.
On macOS, we recommend using its Terminal.
On Windows, we recommend using Windows Terminal. Before you can use SSH, you may need to enable it first.
Login to CLAC using the following command:
ssh YOUR_UNI@clac.cs.columbia.edu
For this course, you should write code using a command line text editor on CLAC. There are two popular text editors in the UNIX environment: Vim and Emacs. They split power users and programmers into two camps (that constantly make fun of each other). The choice between them largely boils down to personal taste. I recommend you pick one of those as your editor and start using it, learning tips and tricks as you go.
You can start with the built-in tutorials: for Vim, run the vimtutor
command;
for Emacs, select “Emacs Tutorial” under the Help menu.
Vim and Emacs have been ported to virtually every platform, so you can install
and use them on your PC or Mac as well.
Another possibility is Nano (also called Pico). Nano is very easy to use, especially for beginners, but it is rather limited in functionality. It is only recommended for those who are new to UNIX and feel there are just too many things to learn before you get to do anything. Even so, we recommend that you switch to either Vim (or Emacs) as early as possible.
The application you interact with in your terminal window – the program that
prints the command prompt and carries out the commands that you type – is
called a “shell”. There are many different shells. Your CLAC account is
configured to use the Bash shell by default, so if you run echo $SHELL
on
CLAC, it should tell you that you are using Bash:
$ echo $SHELL
/bin/bash
EDITOR
You should set up your shell environment and indicate your preferred text
editor. This way, other command-line applications will know which editor to
use when they need your input. To set this up, you will modify your .bashrc
file. This file is located in your home directory, and is used to configure
your shell environment when you log in.
On CLAC, open up .bashrc
in your text editor. For example, to open it using
nano
, run:
$ nano ~/.bashrc
At the bottom of the .bashrc
file, add the following line:
export EDITOR=your_editor
You should of course replace your_editor
with either vim
, emacs
, or
nano
, according to your preference. Also note that you should not leave
spaces around the =
.
Save your changes to ~/.bashrc and exit your text editor.
To check whether you successfully set up your EDITOR
, log out of CLAC
by running the following:
$ exit
, then log in again. Then, run echo $EDITOR
to
see if your configuration has taken effect; for example, if you set vim
as
your preferred editor:
$ echo $EDITOR
vim
If that didn’t work, you may need to add the following lines to
~/.bash_profile
or ~/.profile
, whichever is present in ~
(i.e., your home directory). Run ls -al ~
to find out.
If neither is present, you can create ~/.bash_profile
with the lines:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
Make sure to place these lines in a file named ~/.bash_profile
(or ~/.profile
), not
in ~/.bashrc
. Adding them to ~/.bashrc
will result in an infinite loop
of sourcing ~/.bashrc
.
In this class, you will use Git to obtain, work on, and submit your assignments. Before you can author any Git commits, you need to tell Git your authorship information.
You should run the following command with your full name:
$ git config --global user.name "Your Full Name"
And the following command with your UNI email address:
$ git config --global user.email UNI@columbia.edu/barnard.edu
git config
will store this information in ~/.gitconfig
for you. You can
verify that this information was set correctly by running the following:
$ git config --global user.name
John Hui
$ git config --global user.email
uni1234@columbia.edu
This guide was originally written by Jae Woo Lee.
Maÿlis Whetsel and John Hui adapted it for the web in Spring 2022.
Last updated: 2023-09-08