Linux

* Written by Prof. Margaret Lamb.

In CISC 220 we will be using the Linux operating system.  We’ll spend the first few weeks of the term learning about Linux and the bash shell, and we’ll continue to make use of Linux during the rest of the course.

Getting Linux:

There are many options.  Whatever you choose, you should use Xubuntu (or Ubuntu) and the bash shell so that scripts and programs you write for assignments, quizzes or the final exam will work on the Queen’s Linux machines, which is our standard for correctness.  If you have access to a different “flavour” of Linux go ahead and use it, but check your assignments on a Queen’s machine before you submit them to avoid surprises.

These options start from the simplest ones:

  1. Do your course work in Goodwin 248 and/or Walter Light.  The machines there are Windows/Linux dual boot.  If a machine you want to use is currently running Windows, just reboot and choose Linux when asked which OS you want.
  2. From anywhere on the Internet, use a secure shell program to access bash on one of the School of Computing’s dedicated Linux computers.  Instructions for installing and setting up one of these programs may be found on the CASLab web site (from the left-hand menu, choose “how to…” and then “use SSH”.  It’s very important that you do your work on one of the computers intended for student use (caslab1, caslab2,… caslab6) instead of directly on the zeus machine (also known as hera).  Zeus is used as a central controller and file server and if CISC 220 students use it for their own work it will start slowing down everyone on all of the lab machines and you may get some very annoyed e-mail from me or our lab people!  If you use the directions for configuring putty at home, when you connect to CASLab you’ll be asked to choose one of the 6 caslab educational computers.  If you connect a different way and go directly to hera, you will see a message asking you to run the caslinux command, which will get you to that menu and move you to one of the 6 caslab computers.  Please do that immediately.
  3. Install Ubuntu on a computer that you own.   Linux is free and may be downloaded fromhttp://www.ubuntu.com/download
  4. Install a virtual machine program such as VirtualBox on your computer, then install Utuntu onto that virtual computers.  Advantages: you can have multiple operating systems on one computer.  Disadvantage: a virtual machine runs a bit slower because it’s emulating instructions rather than running them directly on your hardware.
  5. I used to recommend creating a dual-boot system, where you give your Windows or Mac machine the capability of booting into either your original system or Linux.  I’m no longer comfortable suggesting this.  It is tricky to accomplish and has gotten worse, especially with Windows because Microsoft does not like to share!  If you want to attempt it, there is information on the web, but be sure to back up everything you care about on your computer before you start and make sure you have a disk to re-install your original operating system if something goes wrong.
  6. If you’ve got a Mac, the terminal is actually a bash shell; the current Mac operating systems are built on top of Linux.  The details may not be exactly like the CASLab Linux system, but they will be pretty close.
  7. If you’re running Windows, you can download a copy of the Cygwin program, which provides Linux-like shells and other Linux-like programs that run on Windows.  Always check your work on a “real” linux system, but cygwin is a good option for practicing away from the labs if you’ve got a Windows computer but no Internet connection.

Online Linux Resources:

  • Unix/vim “cheat sheet”, prepared for CISC 221 by Adrian Thurston, who TA-ed for 220 in 2007 and shared it with us
  • The Quick Reference Cards site includes reference cards about several topics that might be useful for students in 220 (bash, c, vim and xemacs)
  • The campus bookstore sells some inexpensive “QuickStudy” guides covering various topics, including Linux. Some students in previous terms have found the Linux guide helpful. It’s just a laminated sheet with reminders of common Linux commands and rules. Last time I checked, they had them by the stairs leading down to the textbook area.
  • The GNU Project home page explains the GNU project and the concept of free software. Since we’ll be using GNU software all term, it’s nice to know the philosophy behind it. There’s also a “documentation” link near the top of the page that leads to lots of useful stuff.
  • The Bash Reference Manual contains complete documentation for the Bash shell and all of its built-in commands. It’s a very detailed manual, not something you would sit down and read from cover to cover. But if you want to look up a specific detail, this is the place.
  • The Bash “Coreutils” Manual contains documentation for many bash commands which are not built in to the shell but are considered part of the core of GNU. This includes many of the commands we will discuss during the first there topics. You might find the section about file permissions helpful if our discussion of chmod leaves you confused. Once again, this is a very detailed manual and contains much more information than I expect students in this course to know.
  • If you find that the official GNU documentation is too full of picky details, there are plenty of Linux tutorials and explanations on the web. Here are a list of a few that I and 220 students have found. A google search will get you many more.
  • Documentation for Linux Text Editors: Most hard-core Linux programmers use either vim or emacs. I encourage you to try one of those, or else nano if you want something simpler. SciTE and gedit are nice editors too, but you can’t use them with the terminal window, which means you won’t be able to edit files over a text-oriented SSH connection such as putty.
    • Vim: The best way I know to learn vim is to type vimtutor to the command prompt. That gives you a very nice interactive tutorial that encourages you to practice as you read. You can also print yourself a copy of this quick reference card to have on hand as you’re learning vim.
    • Emacs: The best way to learn Emacs is to use its own built-in tutorial. Start up Emacs, then type control-h, then t. If you prefer a tutorial on a web page, there are many of those; just google “emacs tutorial”. This quick reference card may also be useful. If you really want a lot of information, you may consult the GNU Emacs manual; it’s more than a beginner would want to read through, but it’s a good, complete reference for looking up details as you progress.
    • nano: A very simple text editor. It’s good for a quick start, but you may be wishing for a more powerful editor by the end of the term. You may find you can figure out how to use it just by observing the hints at the bottom of the screen (remember that “^” means the control key). For more help, you can type control-G while running nano, or you can look at the Nano Basics Guide, a nice quick introduction to nano, or use the complete nano Command Manual.
    • SciTE: A simple editor. This one has the advantage of being available for both Linux and windows, and is especially geared towards editing source code in various languages. A warning: SciTE will not run over putty like the three editors listed above; it needs the graphics system. If you choose Help->SciTE Help while running SciTE, it will open up a manual in a separate window, or you may go directly to the sCIte documentation page.
    • gedit: One more simple text editor. This one looks a lot like Notepad. Like SciTE, it requires a GUI interface; you can’t use it with putty. It’s not difficult to use, but you can consult the Gedit Manual if you run into questions.