(Re)introduction to Unix Sarah Medland. So Unix…  Long and venerable history  

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
1 Basics of Linux On linux machine: Login at your home directory Open a “shell” or “terminal” or “xterm” workspace (4) On windows machine Intall linux.
Lecture 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
Shell Scripting Basics Arun Sethuraman. What’s a shell? Command line interpreter for Unix Bourne (sh), Bourne-again (bash), C shell (csh, tcsh), etc Handful.
Introduction to Linux and Shell Scripting Jacob Chan.
Linux Commands LINUX COMMANDS.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Chapter 4: UNIX File Processing Input and Output.
Advanced File Processing
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”
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Essential Unix at ACEnet Joey Bernard, Computational Research Consultant.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
File Processing. Introduction More UNIX commands for handling files Regular Expressions and Searching files Redirection and pipes Bash facilities.
Unix Basics Chapter 4.
A Guide to Unix Using Linux Fourth Edition
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Dedan Githae, BecA-ILRI Hub Introduction to Linux / UNIX OS MARI eBioKit Workshop; Nov , 2014.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Chapter Five Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
(Re)introduction to Unix Sarah Medland. So Unix…  Long and venerable history  
Getting the most out of the workshop Ask questions!!! Don’t sit next to someone you already know Work with someone with a different skillset and different.
40 Years and Still Rocking the Terminal!
CSC414 “Introduction to UNIX/ Linux” Lecture 5. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
1 CS3695/M6-109 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Sed. Class Issues vSphere Issues – root only until lab 3.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
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.
+ Introduction to Unix Joey Azofeifa Dowell Lab Short Read Class Day 2 (Slides inspired by David Knox)
Learning Unix/Linux Based on slides from: Eric Bishop.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Tutorial of Unix Command & shell scriptS 5027
(Re) introduction to Linux Sarah Medland Boulder 2017
Getting started with CentOS Linux
Chapter 11 Command-Line Master Class
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Prepared by: Eng. Maryam Adel Abdel-Hady
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Some Linux Commands.
Linux command line basics III: piping commands for text processing
Shell Script Assignment 1.
INTRODUCTION TO UNIX: The Shell Command Interface
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Introduction to UNIX.
Tutorial of Unix Command & shell scriptS 5027
(Re) introduction to Linux Sarah Medland Boulder 2015
Guide To UNIX Using Linux Third Edition
Tutorial of Unix Command & shell scriptS 5027
UNIX Reference Sheets CSE 2031 Fall 2010.
Getting started with CentOS Linux
Tutorial Unix Command & Makefile CIS 5027
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
Linux Commands LINUX COMMANDS.
Introduction to Linux Commands
Presentation transcript:

(Re)introduction to Unix Sarah Medland

So Unix…  Long and venerable history   Numerous ‘flavours’ or shells b – Bourne shell k – Korn shell tcsh – tenex bash – Bourne Again Shell

Using Unix  Servers Linux  Mac Terminal  PC Cygwin

Getting started…  Changing directory cd C:// Going back one step cd.. Finding out where you are pwd Making a directory mkdir wedtemp cd wedtemp !!!!Unix is case sensitive!!!!

Formats  NO SPACES in your file/directory names!!  To get from DOS (windows) format to Unix use dos2unix  To get from Unix to Dos unix2dos Type: dos2unix output.mxo  Wildcard dos2unix *.mxo

Input …. Output  Input Most commands don’t need input signifiers < can be used to specify  Output Without specifying most output will print to the screen > can be used to direct  type: echo ‘this is a dummy file’  echo ‘this is a dummy file’ > dummy.txt | (pipe) | more pauses the output after a screen worth of text has appeared hit the space bar to get the next screens worth

The manual  The man command can be used in conjunction with other commands to put up some basic instructions  type: man ls ls is the list command it pulls up a list of the files in the directory Also many many helpful webpages w examples

Permissions the ability to read, write and execute files  type: ls –l  These are the permissions  1st a directory flag (d or -)  then 3 letters to define the owners permissions  3 letters to define the groups permissions  3 letters to define the everyone else's permissions

Permissions the ability to read, write and execute files  read access  write access  execute to ‘run’ script or a program the file must be made executable

Permissions the ability to read, write and execute files  To change the mode/permissions use chmod a number of ways to do this type: ls –l chmod +x dummy.txt ls –l chmod -x dummy.txt ls –l what happened?

Useful ‘one liners’  cp copy  mv move = rename  rm remove  ls list  echo  head looks at the top 10 lines  tail looks at the last 10 lines  wc counts number of lines, words, characters

Grep  search globally for lines matching the regular expression, and print them For example output.mxo is output from a loop script which ran linkage at 59 loci (FEQmodel_Pihat1-59_DZibd.mx) To extract the -2LL at these loci Type: grep ‘of data’ output.mxo > ll.txt

Grep  Useful flags -v  reverse grep select line that does not have the pattern -f filename  To obtain patterns from a file -n  Print the line number before the line Many more…

Awk  derived from the surnames of its authors — Alfred Aho, Peter Weinberger, and Brian Kernighan  Many functions  Very useful for restructuring data

Awk  Ozbmi2.rec  awk ‘{ print $1, $10, $11, $4, $5 ;}’ ozbmi2.rec > new.rec

Awk  $1 = column 1  Print $0 = print whole line  add subtract multiply etc  change number of decimals  Many functions

Sort  Useful flags -f ignore case -n numeric sort -r reverse -c check if a file is sorted -u prints only unique lines -k2 sort starting at column2

Putting it together  Making a ‘shell’ script to automate analyses pedstats –p 1.ped –d 1.dat –pdf --prefix:1 merlin –p 1.ped –d 1.dat –m 1.map --vc --pdf --prefix:1 pedstats –p 2.ped –d 2.dat –pdf --prefix:2 merlin –p 2.ped –d 2.dat –m 2.map --vc --pdf --prefix:2 pedstats –p 3.ped –d 3.dat –pdf --prefix:3 merlin –p 3.ped –d 3.dat –m 3.map --vc --pdf --prefix:3 To run this make inefficient.sh executable then type./inefficient.sh

Loops 1 for $i in do pedstats –p $i.ped –d $i.dat --pdf --prefix:$i merlin –p $i.ped –d $i.dat –m $i.map --vc --pdf --prefix:$i done

Loops 2 for (( i = 1 ; i <= 22 ; i++ )) do pedstats –p $i.ped –d $i.dat --pdf --prefix:$i merlin –p $i.ped –d $i.dat –m $i.map --vc --pdf -- prefix:$i done

Permutation #Permutation for sibpair linkage at 728 loci for (( b = 1 ; b <= 728 ; b++ )) do cp use"$b" mx.dat #permute & re-run analysis times at each locus for (( c = 1 ; c <= ; c++ )) do echo m $b rep $c # awk 'BEGIN {srand()} {print $1, $2, $3, $4, $5, rand() ;}' mx.dat | sort -k6 > perm paste -d " " perm pheno.txt > use./mx63.bat perm.mx grep "of data" perm.mxo >> link"$b".txt done #______________________________ done #______________________________

Permutation #Permutation for sibpair linkage at 728 loci for (( b = 1 ; b <= 728 ; b++ )) do cp loci"$b" mx.dat Fam ibd0 ibd1m ibd1p ibd2 trait1 sex1 trait2 sex2 cov1 cov2

Permutation #permute & re-run analysis times at each locus for (( c = 1 ; c <= ; c++ )) do echo m $b rep $c # awk 'BEGIN {srand()} {print $1, $2, $3, $4, $5, rand() ;}' mx.dat | sort -k6 > perm Fam ibd0 ibd1m ibd1p ibd2 random (based on time)

Permutation paste -d " " perm pheno.txt > use perm + pheno.txt >use

Permutation./mx63.bat perm.mx grep "of data" perm.mxo >> link"$b".txt done #______________________________ done #______________________________ Link728.txt

Other bits  When working on servers bg & fg nohup crtl+c crtl+z which

Shutting down you unix session  exit  logout  quit  q

Time for coffee explodingdog.com