Department of Engineering

IT Services

A short Unix crib

These commands should suffice for 1B IDP and IIA coursework. You type them into a Terminal window - use the little terminal icon at the foot of the screen to start a new one.

Listing files and moving around

  • pwd
    (Print Working Directory) Display on the screen the name of the current folder
  • cd
    (Change Directory) Move to another folder
    • cd XYZ
      move to a folder called XYZ within the current folder
    • cd
      move to your home folder
    • cd ..
      move "up" into the enclosing folder
  • ls
    (LiSt) List the files and folders in the current folder
  • rm filename[s]
    (ReMove) Remove the files

Typing commands

If you press the TAB key, the system will try to complete a filename/foldername. For example, if the only folder you have in the current folder is called 1AComputing then typing

   cd 1A

and pressing the TAB key will give you the completed command. If there's more than one way to complete the command, press the TAB key twice to get a list of alternatives.

You can retrieve previous commands using the up arrow key. When you press the Return key the whole line will be executed even if the cursor isn't at the right end of the line.

Running programs

You can run system programs by typing their name - e.g. typing firefox runs the Firefox browser. If you have a program (called robot, say) in the current directory, you run it by typing ./robot. If you run a program and it seems to be stuck, you can kill it by pressing the Ctrl and C keys down at the same time.

For more information see the Unix from the command line page or use the man (MANual) command - e.g.

 
   man ls

displays the manual of the ls command.