Today will start using the Linux shell: a command line interface to launch programs. Our goals are:
1) Getting familiar with Ubuntu
2) Start typing commands in a terminal
3) Understanding simple text files and their importance in bioinformatics
This is the first time we use the computer room. Please, skim the whole instructions post before starting. Then take some time (at least 1h) to work alone. Remember that Google is your friend. See the Computer Lab page for general hints.
Try getting familiar with Ubuntu. Try yourself, ask your lab mates… and perform these tasks:
- Open the file manager and check which directories are present in your home directory. Try to browse the disk and see how to use the file manager (it’s called Nautilus, by the way). Try creating a new folder in your home folder, calling it “dir-01“.
- Open the text editor “gedit”, create a file (write whatever you want) and save it in your home directory calling it “file1.txt“. To open a program not listed in the left sidebar, just hit the “Windows” logo key, then type the program name (gedit) and finally click its icon.
- Download this PDF file and save it in your home directory: metagenomics.pdf
Understanding where files are is a very crucial step. This is called “browsing the filesystem” and you should read this post to have a first idea about this (we’ll review some concepts later, but have a look now).
Launching the terminal
Open the Terminal. In the latest Ubuntu release you can press the “Windows Logo key” in the keyboard to open a panel, then start typing “Terminal” until you see the program icon to be clicked.
The first letters you see are called “the prompt”. It’s a short text telling you useful informations and it’s highly customizable. This means most PC have a different “prompt”, but usually it’s something like:
username@computername /where/you/are $
The “$” is a popular symbol meaning: “you can start typing commands”. If you have administrator privileges the dollar will turn into a “#“.
The “/where/you/are” part is called “path”. It means where are you (in which directory are you located). Note that the ~ symbol is a shortcut and means “your home directory”.
Have a look at this online manual.
Now let’s start learning some commands:
Means “print working directory”. After typing it hit ENTER to launch. Will return the full path where you are. It’s so important to know where you are that you should keep this command in mind. Consider that:
- you have a personal directory – called the home directory – that is something like /home/yourname/, and it’s abbreviated with ~ (Left Alt+ì in Italian keyboards). Thus typing “cd ~” means “bring me to my home folder”.
- A dot “.” is a shortcut for the current directory.
- A double dot “..” is a shortcut for the upper directory (the one that contain the current). Thus typing “cd ..” means “bring me to the upper level / parent directory”.
Means “list”. Type it and hit ENTER to see the content of the current directory. If you add the “-l” switch will change the output into a detailed list. If you do an “ls” inside your home you should see the directory “dir-01” you created at the begin of this tutorial.
Means “change directory”. If you want to go to another directory type “cd directory-to-go-to”. If you are in your home you can type “cd Scrivania” to enter the Desktop folder. If you are in your home directory and you type “cd Documenti” you are asking to enter the Documenti directory located within the current directory. If you now type “pwd” you should see that you changed directory. And if you type “cd ..” you should return to the upper level. As the ~ is a shortcut for the home folder typing “cd ~” will transport you in your home.
IMPORTANT: Learn how to use the “Tab” key to autocomplete names. Try with “cd dir” then hit “TAB”. Can you enter the “dir-01” directory?
Means “make directory”. Will create a new directory and you have to specify its name. Like “mkdir dir-02“. Then use “ls” to see if you see the newly created directory. And “cd” to enter in it, “cd ..” to return to the upper level.
This powerful tool download a file from the Internet. Go to the “dir-01” directory you created in advance using the “cd” command, then type:
Substitute XX with the number in your login. This will download the multi FASTA file containing a set of 16S rRNA sequences. Do an “ls” to see if the file was downloaded properly.
Now let’s take a break… before proceding you should ensure that you are able to:
– open a terminal and check the directory you are in
– list the files of a directory
– go to a specific directory
Continue with the second part of the laboratory…