Download presentation
Presentation is loading. Please wait.
Published byBrendan Potter Modified over 8 years ago
1
+ Introduction to Unix Joey Azofeifa Dowell Lab Short Read Class Day 2 (Slides inspired by David Knox)
2
+ Overview of Computer Architecture Central Processing Unit “CPU” Random Access Memory “RAM” Disk Storage Input / Output Devices (I/O) …how we do we manage these resources
3
+ The Operating System (OS) is responsible for managing the resources Central Processing Unit “CPU” Random Access Memory “RAM” Disk Storage Input / Output Devices (I/O)
4
+ How do we interact with the OS? Central Processing Unit “CPU” Random Access Memory “RAM” Disk Storage Input / Output Devices (I/O) Today: through the shell/command line
5
+ Directory trees encode file system = /joeyazo/Desktop/Lab/Talks/2015/ShortReadDay_2
6
+ Why are they called directory trees? 2013 2014 2015 … … … … … … …
7
+ Logging into Vieques Open your terminal (MAC) or PuTTy (PC) Login onto the server: ssh username@vieques.colorado.eduusername@vieques.colorado.edu Do you see this?
8
+ Moving through your directories/folders (pwd, ls, cd) $pwd “this provides the current directory tree”, what do you see? $ ls “stands for list”, lists the contents of the working directory (or the director/folder you are currently in) $ cd /projects/sreadgrp/homeworkfiles “stands for change directory and provide the file desination you want to go to” $pwd (what do you see now?) $ls (what do you see?) …now move back into your home directory (shortcut: $ cd ~) “$___” means You run this command
9
+ Copying files from place to another (cp) $ Make a folder (make sure you are in your home directory, ($cd ~) or ($cd /Users/yourUserName/ ) )! $mkdir Day2 $cd Day2 $pwd Copy a file into your new folder! cp (what you want to copy) (where you want it to go) $cd /projects/sreadgrp/homeworkfiles/genomes/S288c/ $cp saccharomyces_cerevisiae.gff /Users/yourUserName/Day2/ $ls –l /Users/yourUserName/Day2/ (what do you see now?) Tab complete is your best friend! “$___” means You run this command
10
+ Using Wild Cards (*) $ ls *.txt means list all files that end with.txt (this is called a “regular expression”); ls *.fasta means list all the files that end with.fasta. You can use this * prefix with most unix commands Make a new folder in Day2/ called fastaFiles/ $mkdir FastaFiles (make sure you are in /Users/yourUserName/Day2/; “cd” in if you need to and check through “pwd”) $cd /projects/sreadgrp/homeworkfiles/genomes/S288c/ $ls *.fasta what do you see now? $cp *.fasta /Users/ /Day2/FastaFiles $ls /Users/ /Day2/FastaFiles what do you see now? Make a new folder gffFiles in /Users/yourUserName/Day2/ $cd /Users/yourUserName/Day2/ $mkdir gffFiles $mv *.gff gffFiles/ (mv stands for moves; remember you need to be /projects/sreadgrp/homeworkfiles/genomes/S288c/ or give full path for mv wild card command! ) $ls –l gffFiles/ (what do you see now?) “$___” means You run this command
11
+ Looking at the contents of your files (wc, head, tail, cat) $cd /Users/yourUserName/Day2/FastaFiles $head orf_coding_all.fasta (what do you see) By default head shows the first 10 lines, we can make it arbitrary $head -100 orf_coding_all.fasta (shows the first 100 lines) (now show the first 200 lines) $tail orf_coding_all.fasta (shows the last 10 lines by default) (similar to the “head” command, show the last 100 lines) $wc orf_coding_all.fasta (what do you see?, wc stands for word count) $wc –l orf_coding_all.fasta (what do you see ?) $wc –help (this gives you all the command options you can use with wc) Now find the byte count, how many megabytes is that? Remember for one megabyte there 1,000,000 bytes. $cat orf_coding_all.fasta (prints the ENTIRE contents of the file…I wouldn’t run this out right? WHY?) “$___” means You run this command
12
+ Removing Files (rm) beware… Change directories into Day2/FastaFiles/ $cd /Users/yourUserName/Day2/FastaFiles Remove the file orf_coding_all.fasta; remove template $rm $rm orf_coding_all.fasta $ls (what do you see now?) Recopy orf_coding_all.fasta from /projects/sreadgrp/homeworkfiles/genomes/S288c/ $cp /projects/sreadgrp/homeworkfiles/genomes/S288c/orf_codi ng_all.fasta /Users/yourUserName/Day2/FastaFiles “$___” means You run this command
13
+ Redirecting output (| and >) Find all the lines that contain “>”; use the “grep” command stands for get regular expression $grep “>” orf_coding_all.fasta (what happened?) Lets count the number of lines that contain “>” $grep “>” orf_coding_all.fasta | wc –l Now lets send (redirect) all the lines containing “>” to a new file; here we sending the output from one command to a file! $grep “>” orf_coding_all.fasta > header_lines $head header_lines (what do you see now?) “$___” means You run this command
14
+ Searching through files (grep) $cd /Users/yourUserName/Day2/gffFiles/ $grep ’FLO11' saccharomyces_cerevisiae.gff now count the number lines that just contain “FLO”; how many do you see? “$___” means You run this command
15
+ Searching through your directory trees (find) command skeleton: find -name Find all gff files from /projects/sreadgrp/ $find /projects/sreadgrp/ -name "*.gff*” This is a little advanced; take all the output from find and run a command over them! Skeleton find - name -exec {} \; Take the output from find, grabbing.gff files and count number FLO11 ocurrences $find /projects/sreadgrp/ -name "*.gff*" -exec cat {} \; | grep ".*FLO11.*" | wc -l “$___” means You run this command
16
+ The Last Bit: File Permissions (chmod) Template: $chmod Change into Day2/FastaFiles/ $cd /Users/YourUserName/Day2/FastaFiles Change the file permissions so that YOU can read, people in your group can read and execute and others can just read $chmod u=rwx,g=rx,o=r orf_coding_all.fasta the u ser can r ead, w rite, and e x ecute it; members of your g roup can r ead and e x ecute it; and o thers may only r ead it. Change the filer permissions so that EVERYBODY can read,write and execute orf_coding_all.fasta “$___” means You run this command
17
+ All DONE!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.