Introduction To Computing: Difference between revisions

From MDWiki
Jump to navigationJump to search
Line 14: Line 14:


== Commands ==
== Commands ==
Try running a command. <code>ls</code> will list the files in the current working directory. A good list of commands may be found [[http://www.ss64.com/bash/ here]].
Try running a command. <code>ls</code> will list the files in the current working directory. A good list of commands may be found [http://www.ss64.com/bash/ here].


== Shells ==
== Shells ==

Revision as of 02:01, 8 May 2009

Introduction

Hi there! This page is designed to give you a general introduction to computing at the MD lab. There are a number of topics.

General Policy

The computers are there to share. Anyone should be able to login to any computer, so please logout when you are not using the computer (within reason). Please don't switch off the computers. If there is a problem with the computer, such as the screen freezing, it is probably a problem with the network. If this occurs, please talk to a post-doc rather than just rebooting the computer. If the computer needs to be shutdown or rebooted, whether there is a problem or not, you should check to see if anyone is running a job on the computer using the top command and you should check to see if anyone is logged in using the who command.

Using Linux

Linux may be quite new to you, so a short introduction is provided here. Linux, like Microsoft Windows, is an Operating System, which means it is a priviledged program that manages the hardware and software on your computer. You will probably log on into a Graphical Desktop Environment such as GNOME, which should look similar to other Desktop Environments you have used in the past. The most important part of the Linux desktop is in fact a much older technology called the terminal. By selecting the Applications->Accessories (or Applicaitions->System Tools) menu you can click on the "Terminal" link, which brings up a Terminal emulator program, which runs, inside it, a shell (your shell will probably be the program /bin/bash). This looks like this:

Terminal.png

Commands

Try running a command. ls will list the files in the current working directory. A good list of commands may be found here.

Shells

There are different families of shells, such as /bin/tcsh, /bin/bash. The main different is the syntax used for shell scripts. Type echo $SHELL to work out which shell you have been given. A system administrator can change it for you.

Let's assume you are using bash. Whenever you login via SSH to a computer a file called .bash_profile in your home directory is read (Type echo $HOME to see the location of your home directory), and the commands within it are executed by the new shell instance. However, when a new shell is created by opening a new Terminal window, a different file (.bashrc) is instead similarly processed. It is recommended that you include a command within your .bash_profile to read in the commands in the .bashrc file (although don't also read the .bash_profile commands from the .bashrc file as you will get infinite recursion!). That is, inside .bash_profile ensure the following lines are found. You can use nedit to open the file for editing.

if [ -f $HOME/.bashrc ]; then
  . $HOME/.bashrc;
fi;

Jobs on Workstations

The workstations are configured like the cluster which means that you can run jobs on them. To run a job on a workstation you don't need to use qsub, just execute the script directly in your shell. Please make sure that one core is free at all times (otherwise the person sitting in front of the computer will get poor performance). You can check what is running on the computer using the top command.

Jobs on Cluster