Butlin:Unix for Bioinformatics - basic tutorial: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
Line 136: Line 136:




{| class="wikitable" border="l" style=width: 60%"
{| class="wikitable" border="l" style="width: 60%; background: #f9f9f9" align="center" cellpadding="5"
|+ Navigation in the manual which is opened by the text viewer less:
|+ Navigation in the manual which is opened by the text viewer less:
|-
|- style="background: #f2f2f2"
! Keyboard !! What it does
! Keyboard !! What it does
|-  
|- align="center"
| f or Space || one screen size down  
| f or Space || one screen size down  
|-
|- align="center"
| b || one screen size up  
| b || one screen size up  
|-
|- align="center"
| d || half a screen size down  
| d || half a screen size down  
|-
|- align="center"
| u || half a screen size up  
| u || half a screen size up  
|-
|- align="center"
| G || jump to end of file  
| G || jump to end of file  
|-
|- align="center"
| g || jump to beginning of file  
| g || jump to beginning of file  
|-
|- align="center"
| h || get help
| h || get help
|-
|- align="center"
| q || exit help
| q || exit help
|-
|- align="center"
| q || exit less
| q || exit less
|}
|}

Revision as of 10:45, 9 August 2013

Before you jump into this tutorial

  • Your command line prompt will end with a $ sign. So a $ sign in this tutorial tells you to type the stuff that comes after the $ sign into your command line.
  • The words folder and directory mean the same thing. So I use them interchangeably.
  • Linux is Unix re-coded under an open-source licence, the same way as R is a re-coded version of S. Here, when I use the term Unix, I refer to all Unix-like computing environments, i. e. the original Unix that comes with Macs as well as most Linux flavours.
  • The practical part of the workshop will be done on the computer cluster of the University of Sheffield called Iceberg. It has scientific Linux installed. You will log into your own accounts on Iceberg.
  • If you have never used a Unix command line, we suggest you concentrate on the boldly printed text in the first two sections in this module. Make sure you get through them in time so that you are fit to do the rest of the workshop.
  • There are still small (hopefully not large) bugs lurking in this protocol. Please help improve it by adding comments.

Iceberg - making first contact

Access with the programme PuTTY

If PuTTY can’t be found on your computer, go to section 1.2 Access via an internet browser.

Chose “iceberg” and press “Open”.

Type in the login name that you have been given, hit Enter, then type in the password and hit Enter.


Access via an internet browser

If PuTTY is not installed, you have to use an internet browser to access Iceberg.


Follow the link “Connect to Iceberg now!” on this site.


Insert the username/login name and password that you have been given.


Under Iceberg Applications select Iceberg terminal.


A new window will pop up.


Iceberg access for Mac and Linux users

Open a terminal, then type at the command line prompt:

ssh   -X   your_username@iceberg.shef.ac.uk

You will be asked for your iceberg password and at the first time it usually issues a warning about accessing an untrusted server. Just confirm that you want to add iceberg to your trusted server connections. The -X switch opens a connection with X11 forwarding. If you don’t intend to open a GUI on iceberg, skip that switch.


Some basics

On the head node called “iceberg1” start a new session on one of the worker nodes by typing:

qrsh

No work should ever be done on the head node ‘iceberg1’ or else others and ultimately you will suffer the consequences :-)

If you’ve logged in via the web browser and used qsh (instead of qrsh) to start a new session, then you could open a programme that uses a GUI, e. g. firefox:

firefox

Where am I in the file system?

pwd

Here is a visual representation of a Unix file system:

taken from the Unix Tutorial for Beginners

Every Unix operating system has a root folder simply called /. Let’s see what’s in it:

ls /

List the files in the current directory, i. e. your home directory:

ls


Your home directory is still empty, or is it?

ls -a

The -a switch makes ls show hidden files, which start with a dot in their file name. Let’s create a new directory and a new empty file.

mkdir NGS_workshop
ls
cd NGS_workshop
ls
touch test
ls -l

The list output of ls prints out a lot of information about each file and directory.

drwxr-xr-x    4 cliff    user        1024 Jun 18 09:40 directory_name
-rw-r--r--    1 cliff    user      767392 Jun  6 14:28 file_name
^ ^  ^  ^     ^   ^       ^           ^      ^    ^      ^
| |  |  |     |   |       |           |      |    |      |  
| |  |  |     | owner   group       size   date  time    name 
| |  |  |     number of links to file or directory contents
| |  |  permissions for world
| |  permissions for members of group
| permissions for owner of file: r = read, w = write, x = execute -=no permission
type of file: - = normal file, d=directory, l = symbolic link, and others...


$ ls -lF

Note the forward slash at the end of file names, when you use the -F option. This indicates a directory.

$ ls -lh

How can I look up the manual for the ls command and most other Unix commands?

$ man ls


Navigation in the manual which is opened by the text viewer less:
Keyboard What it does
f or Space one screen size down
b one screen size up
d half a screen size down
u half a screen size up
G jump to end of file
g jump to beginning of file
h get help
q exit help
q exit less