The Genome Analysis Centre
Building Excellence in Genomics and Computational Bioscience
Building Excellence in Genomics and Computational Bioscience
A Basic Introduction to Linux
Paul Galley
paul.galley@tgac.ac.uk
The Genome Analysis Centre
The Genome Analysis Centre
So what is Linux?
• It’s an operating system or OS.
• It comes in many distributions.
• For this training course we will be using
Ubuntu.
The Genome Analysis Centre
The Genome Analysis Centre
Time for a quick history lesson.
• Linux is an offshoot of Unix.
• Developed by Bell Labs in 1969
• Aim of allowing multiple users to work
simultaneously.
• Early 90’s Unix had become so important Linux
was developed.
The Genome Analysis Centre
The Genome Analysis Centre
So that’s the History, what about the present?
• The most ported OS across the globe.
• June 2013 > 95% of the world’s 500 fastest
supercomputers are using Linux.
• Linux dominated the top 44 entirely.
The Genome Analysis Centre
The Genome Analysis Centre
Why do we use it instead of another OS?
• The cost right
• Visible source code
• Linux promotes open sourcing and freeware of
the applications written to run on it.
The Genome Analysis Centre
The Genome Analysis Centre
Any other reasons?
Another reason that has been suggested is that
Linux has the better mascot. Allow me to
introduce you all to ‘Tux’. - He’s a Libra, likes
Sardines and long walks in the snow
The Genome Analysis Centre
The Genome Analysis Centre
How to access the Terminal
Now you’re in the GUI, In many ways this is very
similar to the Windows or Mac OSX OS ‘s.
To access the terminal you will need to look for
the below icon on the launch bar on the left.
The Genome Analysis Centre
The Genome Analysis Centre
How to access the Terminal
This will result in a window like this.
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
Basic commands, flags and getting around.
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
So now we are in the Terminal how do we get
the computer to do something?
You give the computer a command.
Start with some of the informative commands
then move onto navigational commands.
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
Command Details
who This will display information about who is logged on, both
yourself and others.
whoami This will display information about the current user i.e. You!
ls ls is short hand for LiSt. It will display all the visible files within
the directory that you are currently in. The files will be listed
alphabetically by default but this can be altered with flags.
pwd This will Print the Working Directory. A fancy way of asking the
computer to display information about where you are and
what directory you are currently working in.
apropos Keyword This command followed by a keyword will provide you with
information on commands that are related to that keyword.
man Command This will provide you with the manual for the given command.
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
Using these commands you can gather
information about the digital world around you,
using flags will give you even more control.
We will place the flags behind the ls command
for demonstrative purposes
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
Flag Details
ls -a LiSt All – This will list all of the files in the directory including the hidden dot
files.
ls -l LiSt Long – This will list all the files and/or subdirectories with detailed
information such as file size, date modified etc.
ls -t LiSt Time – This will sort the list into a chronological order based on
modification time.
ls -tu This list will list them chronologically based on the last access date.
ls -R This list will include the content of subdirectories.
ls –S LiSt Size – This list will be based on the size order.
ls –h LiSt Human – this will make the list human readable format for example the
size would be 1.0MB instead of 1004638
ls -r LiSt Reversed – This will list the files in a reverse alphabetical order.
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
It is possible to combine flags for instance ls –alh
would display all files including hidden in the
long format human readable.
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
• The commands for getting around the
directories and file structures are really
simple.
• Inverted tree like design with the root
directory at the top, the user home directory
and other essential folders below that, and
the general directories/subdirectories below
this.
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
Command Details
cd .. Change Directory - to one level up the tree.
cd ~ Change Directory - to the home directory
mkdir Make DIRectory – this creates a new directory within the current
working directory
rmdir Directory ReMove DIRectory – This will remove the named directory, It
must be within the current working directory
rm –r Directory ReMove – the r flag on this command will along with its contents
rm –i Directory ReMove – the i flag on this command will make it so there is user
interaction, i.e. the computer will ask for confirmation
rm –ir Directory ReMove – the combination ir will remove all files within the
directory and ask for confirmation for each file within it.
mv filename new_filename MoVe – This will move the file to a new location
cp filename new_filename CoPy – This will make a copy of the file under the specified
name.
The Genome Analysis Centre
The Genome Analysis Centre
The Basics
One thing to note is that you cannot move directly
between directories on the same level using the cd
command alone, you have to either go up a layer
using the cd .. then cd to the directory or combine
the commands.
You are in dir1 and wish to get to dir2
Route 1 would use the above method of cd ..
followed by a command of cd dir2
Route 2 you could use the command cd ../dir2
You can take this one step further and add in the
sub directory if known that you want to go to.
Cd ../dir2/subdir1
The Genome Analysis Centre
The Genome Analysis Centre
Tips tricks and cheats
Wildcards, auto completes, command history,
quick recall…
The Genome Analysis Centre
The Genome Analysis Centre
Tips tricks and cheats
When searching for files or directories with similar characters or strings in their names
you can use one of two wildcards * and ?
? is used to match a single character
* is used to match multiple characters
When combining these commands with flags you are able to perform many different
functions. A prime example would be the rm flag allowing you to delete multiple files
and directories with a similar name.
When typing in commands and you need to insert a file name you can increase the
speed and accuracy by using the tab key to autocomplete. This works best when you
are using highly unique filenames, for less unique file names it will only partially
complete the file name, up to the point it no longer becomes unique
The up and down arrow keys will recall previously typed commands and the left and
right keys will allow you to edit them.
The history command will also allow you to see a list of previously typed commands.
The Genome Analysis Centre
The Genome Analysis Centre
Basic Exercises
For those of you who have not found them
already there are a list of basic exercises for you
to do to test out what we have gone through
thus far.
The Genome Analysis Centre
The Genome Analysis Centre
Summary
Linux is not scary, it’s just taking you out of your
comfort zone of GUI based operating systems.
The Linux community is superb and there are
thousands upon thousands of helpful guides,
forums and users out there willing to share
knowledge and help the new Linux user.
The Genome Analysis Centre
The Genome Analysis Centre
And finally
Building Excellence in Genomics and Computational Bioscience
Thank you for listening.

Introduction to Linux Slides.pptx

  • 1.
    The Genome AnalysisCentre Building Excellence in Genomics and Computational Bioscience
  • 2.
    Building Excellence inGenomics and Computational Bioscience A Basic Introduction to Linux Paul Galley [email protected]
  • 3.
    The Genome AnalysisCentre The Genome Analysis Centre So what is Linux? • It’s an operating system or OS. • It comes in many distributions. • For this training course we will be using Ubuntu.
  • 4.
    The Genome AnalysisCentre The Genome Analysis Centre Time for a quick history lesson. • Linux is an offshoot of Unix. • Developed by Bell Labs in 1969 • Aim of allowing multiple users to work simultaneously. • Early 90’s Unix had become so important Linux was developed.
  • 5.
    The Genome AnalysisCentre The Genome Analysis Centre So that’s the History, what about the present? • The most ported OS across the globe. • June 2013 > 95% of the world’s 500 fastest supercomputers are using Linux. • Linux dominated the top 44 entirely.
  • 6.
    The Genome AnalysisCentre The Genome Analysis Centre Why do we use it instead of another OS? • The cost right • Visible source code • Linux promotes open sourcing and freeware of the applications written to run on it.
  • 7.
    The Genome AnalysisCentre The Genome Analysis Centre Any other reasons? Another reason that has been suggested is that Linux has the better mascot. Allow me to introduce you all to ‘Tux’. - He’s a Libra, likes Sardines and long walks in the snow
  • 8.
    The Genome AnalysisCentre The Genome Analysis Centre How to access the Terminal Now you’re in the GUI, In many ways this is very similar to the Windows or Mac OSX OS ‘s. To access the terminal you will need to look for the below icon on the launch bar on the left.
  • 9.
    The Genome AnalysisCentre The Genome Analysis Centre How to access the Terminal This will result in a window like this.
  • 10.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics Basic commands, flags and getting around.
  • 11.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics So now we are in the Terminal how do we get the computer to do something? You give the computer a command. Start with some of the informative commands then move onto navigational commands.
  • 12.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics Command Details who This will display information about who is logged on, both yourself and others. whoami This will display information about the current user i.e. You! ls ls is short hand for LiSt. It will display all the visible files within the directory that you are currently in. The files will be listed alphabetically by default but this can be altered with flags. pwd This will Print the Working Directory. A fancy way of asking the computer to display information about where you are and what directory you are currently working in. apropos Keyword This command followed by a keyword will provide you with information on commands that are related to that keyword. man Command This will provide you with the manual for the given command.
  • 13.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics Using these commands you can gather information about the digital world around you, using flags will give you even more control. We will place the flags behind the ls command for demonstrative purposes
  • 14.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics Flag Details ls -a LiSt All – This will list all of the files in the directory including the hidden dot files. ls -l LiSt Long – This will list all the files and/or subdirectories with detailed information such as file size, date modified etc. ls -t LiSt Time – This will sort the list into a chronological order based on modification time. ls -tu This list will list them chronologically based on the last access date. ls -R This list will include the content of subdirectories. ls –S LiSt Size – This list will be based on the size order. ls –h LiSt Human – this will make the list human readable format for example the size would be 1.0MB instead of 1004638 ls -r LiSt Reversed – This will list the files in a reverse alphabetical order.
  • 15.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics It is possible to combine flags for instance ls –alh would display all files including hidden in the long format human readable.
  • 16.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics • The commands for getting around the directories and file structures are really simple. • Inverted tree like design with the root directory at the top, the user home directory and other essential folders below that, and the general directories/subdirectories below this.
  • 17.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics
  • 18.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics Command Details cd .. Change Directory - to one level up the tree. cd ~ Change Directory - to the home directory mkdir Make DIRectory – this creates a new directory within the current working directory rmdir Directory ReMove DIRectory – This will remove the named directory, It must be within the current working directory rm –r Directory ReMove – the r flag on this command will along with its contents rm –i Directory ReMove – the i flag on this command will make it so there is user interaction, i.e. the computer will ask for confirmation rm –ir Directory ReMove – the combination ir will remove all files within the directory and ask for confirmation for each file within it. mv filename new_filename MoVe – This will move the file to a new location cp filename new_filename CoPy – This will make a copy of the file under the specified name.
  • 19.
    The Genome AnalysisCentre The Genome Analysis Centre The Basics One thing to note is that you cannot move directly between directories on the same level using the cd command alone, you have to either go up a layer using the cd .. then cd to the directory or combine the commands. You are in dir1 and wish to get to dir2 Route 1 would use the above method of cd .. followed by a command of cd dir2 Route 2 you could use the command cd ../dir2 You can take this one step further and add in the sub directory if known that you want to go to. Cd ../dir2/subdir1
  • 20.
    The Genome AnalysisCentre The Genome Analysis Centre Tips tricks and cheats Wildcards, auto completes, command history, quick recall…
  • 21.
    The Genome AnalysisCentre The Genome Analysis Centre Tips tricks and cheats When searching for files or directories with similar characters or strings in their names you can use one of two wildcards * and ? ? is used to match a single character * is used to match multiple characters When combining these commands with flags you are able to perform many different functions. A prime example would be the rm flag allowing you to delete multiple files and directories with a similar name. When typing in commands and you need to insert a file name you can increase the speed and accuracy by using the tab key to autocomplete. This works best when you are using highly unique filenames, for less unique file names it will only partially complete the file name, up to the point it no longer becomes unique The up and down arrow keys will recall previously typed commands and the left and right keys will allow you to edit them. The history command will also allow you to see a list of previously typed commands.
  • 22.
    The Genome AnalysisCentre The Genome Analysis Centre Basic Exercises For those of you who have not found them already there are a list of basic exercises for you to do to test out what we have gone through thus far.
  • 23.
    The Genome AnalysisCentre The Genome Analysis Centre Summary Linux is not scary, it’s just taking you out of your comfort zone of GUI based operating systems. The Linux community is superb and there are thousands upon thousands of helpful guides, forums and users out there willing to share knowledge and help the new Linux user.
  • 24.
    The Genome AnalysisCentre The Genome Analysis Centre And finally
  • 25.
    Building Excellence inGenomics and Computational Bioscience Thank you for listening.

Editor's Notes

  • #5 Early Networking.
  • #6 Google, PlayStation, Android devices are all Linux
  • #7 Visible source code means that when an error is found you have potentially the entire community looking into it, so thousands upon thousands of people. This means issues/faults/bugs are fixed a lot quicker than non-visible code like windows or osx
  • #11 They have the option of playing with the commands as I talk about them or waiting to use them at the exercise step. Either way note that Linux is case sensitive
  • #13 Highlight the PWD command, LS command and MAN command
  • #17 Hierarchy system, go up and down, not side to side.
  • #19 Highlight the space in the CD .. Command. Advise that they might need to use shift+| or ¬ to get the ~