Computer Science 217
Using Unix

John Aycock



Common Unix Commands

You'll be taught some more Unix commands as the semester progresses, but these are some basics to get started with:

Edit a file
	gedit filename.py
Start the Python interpreter
	python3
Run a Python program
	python3 filename.py
List files in a directory
	ls
Copy a file
	cp oldfilename newfilename
Warning: Unix assumes that you know what you're doing, and will happily overwrite files without warning if you tell it to!
Move a file
	mv oldfilename newfilename
Warning: Unix assumes that you know what you're doing, and will happily overwrite files without warning if you tell it to!
Rename a file
	mv oldfilename newfilename
Warning: Unix assumes that you know what you're doing, and will happily overwrite files without warning if you tell it to!
Delete a file
	rm filename
Warning: Unix assumes that you know what you're doing, and will happily delete files without warning if you tell it to! There is no ``undo'' available!
Make a directory
	mkdir directoryname
Go into a directory
	cd directoryname
Go back to your home directory
	cd
Be enlightened
	fortune

Working from Your Home or Laptop

If you want to avoid coming into the lab, you can always connect to the Computer Science computers from home or your laptop. Here's how:

  1. Connect to one of the Computer Science machines using ``ssh''. This will give you a secure connection across the network to a shell in your Computer Science account.
    Macs, Linux, and BSD systems
    You already have ssh on your system. Open a terminal window and connect by typing ``ssh machinename'' at the command prompt.
    Windows
    You'll need to install ssh software first. Campus IT has a web page explaining how to do this.
    What machine name should you connect to? Pick one of these: csc.cpsc.ucalgary.ca, csd.cpsc.ucalgary.ca, cse.cpsc.ucalgary.ca, csl.cpsc.ucalgary.ca.
  2. Edit your files using a text-based editor instead of gedit. The text-based ``nano'' editor is easy to learn, for example.
  3. Everything else in the shell works as it does in the Computer Science lab.

Using Python on Your Own Computer

Macs already have Python installed (as does pretty well any modern Linux or BSD system for that matter), however it is usually not Python 3, but an earlier version. Python 3 (which we're using in class) has significant differences from earlier Python versions. You can download Python 3 from the Python web site.

Sorry, but your TAs and I can't provide any technical support for using Python on your own computer; there's simply not the time for it.

Important note: to keep things fair, everyone's assignment demos must run on the Computer Science computers! If you work on different computers, it is your responsibility to make sure your assignment works in your Computer Science account.



John Aycock 2011-12-22