Introduction to Linux Part 1. Content 1.Basic overview of Linux 2.The Linux ‘terminal’ and structure of commands 3.Everyday Linux commands and working.

Slides:



Advertisements
Similar presentations
Linux, it's not Windows A short introduction to the sub-department's computer systems Gareth Thomas.
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
CSCI 1411 FUNDAMENTALS OF COMPUTING LAB Lab Introduction 1 Shane Transue MSCS.
Introduction to Linux Alan Orth April 17, 2010 ILRI, Nairobi.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
Working Environment - - Linux - -.
Virtual Machine and UNIX. What is a VM? VM stands for Virtual Machine. It is a software emulation of hardware. By using a VM, you can have the same hardware.
Basic Unix Dr Tim Cutts Team Leader Systems Support Group Infrastructure Management Team.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
MCB Lecture #3 Sept 2/14 Intro to UNIX terminal.
1 Day 3 Directories Files Moving & Copying. 2 Case Sensitive First thing to learn about UNIX is that everything is case sensitive. Thus the files: –enda.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Dedan Githae, BecA-ILRI Hub Introduction to Linux / UNIX OS MARI eBioKit Workshop; Nov , 2014.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction Unix-like system is everywhere Linux Android for smartphones Google Chrome OS for Chromebook Web.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
PROGRAMMING PROJECT POLICIES AND UNIX INTRO Sal LaMarca CSCI 1302, Fall 2009.
AE6382 Secure Shell Usually referred to as ssh, the name refers to both a program and a protocol. The program ssh is one of the most useful networking.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Usage of Workstation Lecturer: Yu-Hao( 陳郁豪 ) Date:
1 Operating Systems and Using Linux Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Some content in this lecture added.
Operating Systems and Using Linux CMSC 104, Lecture 3 John Y. Park 1.
Chapter 0 A “Quick-Start” into the UNIX Operating System.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Introduction to UNIX Geraint Vaughan. What is UNIX? Command-line operating system (not point- and click) Designed for ‘experts’ Lots of different variants.
Chapter 1 : The Linux System Part 2 Lecture 2 11/14/
Unix and Samba By: IC Labs (Raj Kidambi). What is Unix?  Unix stands for UNiplexed Information and Computing System. (It was originally spelled "Unics.")
Intro to Programming Environment 1. Today You Will Learn how to connect to a machine remotely with “nomachine NX client” Learn how to create a new “source.
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
Unix/Linux for beginners:
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
Introduction to Programming Using C An Introduction to Operating Systems.
The Genome Analysis Centre Building Excellence in Genomics and Computational Bioscience.
Unix Servers Used in This Class  Two Unix servers set up in CS department will be used for some programming projects  Machine name: eustis.eecs.ucf.edu.
AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
 Last lesson, the Windows Operating System was discussed along with the Windows command shell  Unix is a computer operating system, that similarly manages.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
Dr. Sajib Datta Jan 16,  The website is up.  Course lectures will be uploaded there ◦ Check regularly for assignments and update.
Operating Systems and Using Linux Courtesy of John Y. Park 1.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
CS 120 Extra: The CS1 Server Tarik Booker CS 120.
Learning Unix/Linux Based on slides from: Eric Bishop.
Operating systems Lecture #3 Modern OS characteristics.
1 Linux Commands. 2 Path You specify a file or directory by its path name:  the full, or absolute, path name or the one relative to a location. The full.
ENEE150 Discussion 01 Section 0101 Adam Wang.
Tutorial of Unix Command & shell scriptS 5027
CS1010: Intro Workshop.
Stubbs Lab Bioinformatics - 2 Retrieving sequence data files and Linux commands Nov 17, 2016 Joe Troy.
Web Programming Essentials:
FTP Lecture supp.
Some Linux Commands.
Introduction to Linux Dr Karina Kubiak - Ossowska
Lecture #3 Modern OS characteristics
Assignment Preliminaries
Intro to UNIX System and Homework 1
Telnet/SSH Connecting to Hosts Internet Technology.
Lecture #3 Modern OS characteristics
College of Engineering
Web Programming Essentials:
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Tutorial Unix Command & Makefile CIS 5027
Module 6 Working with Files and Directories
Presentation transcript:

Introduction to Linux Part 1

Content 1.Basic overview of Linux 2.The Linux ‘terminal’ and structure of commands 3.Everyday Linux commands and working with files and directories 1.The Linux survival ‘cheat-sheet’ 2.Simple exercises

What is Linux? Simply an operating system, e.g. – Windows  ? – Mac OS X Controls a computer system’s resources Allows us to use those resources while making it difficult enough to ‘break’ things

Why Linux? (Computing Perspective) FREE - can be downloaded in its entirety Portable to almost any hardware platform Made to keep running for years Secure, versatile, scalable Very few bugs and loopholes (if any) survive more than a few hours In this case, free = better quality

Why Linux? (Bioinformatics Perspective) Software developed first for Linux/Unix Convenient built-in system utilities that can be strung together for doing complex analyses Security + Scalability The ‘command line’ – best bioinformatics software first released without fancy interfaces Control + Flexibility Automation - easy to ‘pipeline’ processes

The Linux Filesystem Just like with any window-based systems, you MUST make sub- directories in your home directory to organise your work

The ‘commandline’ One of 2 user interfaces (other is the GUI) Textual ‘shell’ for issuing commands to the system and for viewing/capturing outputs Very powerful way of getting exactly what you want Working remotely on a server is typically via a command line shell Bit of a learning curve, but once it ‘clicks’ you rarely want to click anymore

Commands General structure of Linux commands: $ command -options targets Can automatically save to a file: $ command -options targets > output_file Can let multiple commands ‘play tag’ $ command -options targets | command2 | command3 > output_file NOTES: Spaces are NOT optional RARELY do we view or grab things from non-text formatted files

‘pwd’ & ‘ls’ In pure command line mode, you can’t see where you are in the file system. pwd prints your current working directory ls lists the contents of the working directory – it is the equivalent of double-clicking a folder to see what is inside

rm removes a file from the computer Typing rm myfile removes the file called ‘myfile’ NOTE: there is no ‘Trash’ or ‘Recycle Bin’, so once a file is gone, its gone for good. Very rarely will you need to do rm *, which deletes ALL files in the current folder, so always try to convince yourself NOT to

Getting information about directories pwd (print working directory) ls (list directory contents) ls -l (long listing of directory contents) ls -lh (file size units: KB, MB, GB, etc) ls -lt (sort by time created/edited) ls -ltr (same as above, but reversed) ‘Wildcards’ allowed, eg. ls -ltrh *.txt

Getting basic information about files wc counts the number of characters, words and lines in a file If used without extra options it reports all 3 For specific parts only, use: – wc -c filename (characters) – wc -w filename (words) – wc -l filename (lines) (We’ll see examples in the practical)

Creating, renaming, moving and deleting directories mkdir directory (creates a new directory) mv directory_name new_name – renames if new_name doesn’t exist – moves directory into new_name if new_name exists (NB: Will not ask first) rmdir directory_name (deletes directory ONLY if empty)

Navigating the directory structure ‘/’ is the root of the directory tree cd directory (changes your current working directory to the new directory) – cd / takes you to the root directory – cd takes you home – cd.. takes you one step ‘up’ (closer to root) – cd full-path-to-directory will take you to that directory regardless of where you currently are eg. cd /home/john/music/jack_parow/

Navigation tips Use ‘pwd’ a LOT to get your bearings A plain ‘cd’ will always take you home ‘cd -’ (minus) takes you to the previous directory you were working in Use ‘cd..’ a lot to become used to navigating from memory eg. cd../../microrarray_data/affymetrix/

Copying cp source-file(s) destination, where destination is: – another directory, eg. copying files from an archive to a working directory – a new filename, eg. cp mainfile workingfile Copying entire directories also possible – cp -fr exome1/ exome1_Mar2012/ (identical)

Working with files Rename: mv a.fastq sample_1_1.fq Moving: mv sample_1_1.fq ngs/raw/ Deleting: rm a.fastq.backup Wildcards work (but be careful!) – rm * (removes every file in a directory) – rm *.backup (only operates on files with.backup) – mv *.fastq.backup ngs/backups/

Viewing (text) file contents cat – Short for concatenate – displays contents of file(s) one after the other – writes file contents to terminal (screen) ‘Problem’: if files are bigger than 1 screen’s worth, text just goes flying past and you don’t get to see anything useful

Viewing (text) file contents (2) more – like a cat with pause – still writes to the screen, but in seqments more 1.fasta – has a pattern finding facility, which enables you to jump to first occurrence of the search string sequence: more 1.fasta, /string, for next hit

Viewing (text) file contents (3) nano – simple terminal-based text viewer/editor – basic scrolling and search functions – USAGE: nano 1.fasta – CTRL-W (to find) – CTRL-O to save – CTRL-X to exit CAREFUL working with large files…

Cheat sheets df This covers everyday Linux commands, but… The best cheatsheet is the one you create and keep adding to as you learn new ‘tricks’

3 good options for using Linux 1.Existing Windows computer: – Virtual machine – Dual boot – ‘Linux on a stick’ (See pendrivelinux.com) 2.Dedicated desktop (commodity hardware) 3.Remote server e.g. get an account at your institute or Center for High Performance Computing:

Accessing a remote server Assumes you have an account on said machine Requires a ‘client’ to talk to remote machine Linux and Mac – simply use terminal Windows – download a special program – PuTTY is a good option: –

ssh Network protocol for secure data communication between two computers that connects, via a secure channel over an insecure network Connection is between a SSH server and a SSH client Perfect for shell account access Replaces telnet (never use) which sends passwords in plaintext that can be intercepted

Example ssh session sapphire-5:~ junaid$ ssh password: Linux rocket.sanbi.ac.za server #35-Ubuntu SMP Sat Oct 16 22:02:33 UTC 2010 x86_64 GNU/Linux Welcome to the Ubuntu Server! Last login: Mon May 27 10:25: from ls 20Apr2011-Afr-vs-Rest.zipgene.rc rvm-installer bin/ KGP.bed target_intervals.bed.gz Afr-vs-All-1000G-coding-20Apr2011.txt CE Certification Policy.doc.PDF snpEfftmp Afr-vs-All-HapMap3-coding-20Apr2011.txt tophat_sample2 more Afr-vs-All-1000G-coding-20Apr2011.txt C T rs DDX11L G A rs OR4F G A rs LOC A G rs LOC T C rs LINC T C rs LINC A G rs LINC G A rs LINC T C rs LINC A G rs LINC00115

Moving files across servers Can be between your 1) personal machine and a server or 2) between two remote servers 1.Two methods Commandline (personally preferred) - ftp or sftp Graphical client, eg. – FileZilla: or – WinSCP: 2.Commandline – 2 step ssh into remote server ftp or sftp into second server and initiate transfers

Exercise (Use your notes and ‘cheatsheet’) 1.Open a terminal 2.Check that you are in your home directory 3.Create a directory called ‘exercises’ 4.Can you move this directory to the same level as your home directory? 5.Copy testfiles.zip into the new folder

6.Go into exercises (change working directory ) and uncompress the file called ‘testfiles.zip’ – $ unzip testdata.zip 7.Do a directory listing to see what happened 8.Notice a new directory? Go into it. 9.Do the following and note the differences:  cat gene_expression.diff.txt  more gene_expression.diff.txt (hit ENTER a few times, then hit the SPACEBAR)  nano gene_expression.diff.txt NOTE: copy testfiles.zip into ‘exercises’

10. Concatenate all the files as follows: cat *.txt > joined.txt 11.Make a copy of joined.txt and name it anything you want 12.Do a ‘long’ directory listing to compare sizes of old files and new file. Do the numbers add up? 13.Go back one directory level (cd..) 14. Now copy entire testdata directory as newdata

15.Compare contents of newdata and testdata 16.Try to delete testdata using rmdir – what happens? Make it work. 17.Let’s ‘walk’ through the filesystem a bit. Go into: – newdata – then straight into the root directory (single command) – then back to your home directory (single command)