- Login to O2 and start an interactive session.
Answer: ssh ecommonsID@o2.hms.harvrd.edu
- Change directories into
unix-intro.
Answer: cd unix-intro
- List the contents of the
otherdirectory. How many files are in the folder?
Answer: ls -l other
- Make a copy of the
sequences.fafile and put it in theotherfolder. Name this filesequences-copy.fa.
Answer: cp other/sequences.fa other/sequences-copy.fa
- Change directories into
other. List all theMov10FASTQ files inraw_fastqfrom your current directory without changing directories.
Answer:
ls -l ../raw-fastq/Mov10*
- Do each of the following using a single
lscommand without navigating to a different directory. HINT: You will want to use a wildcard here.
Answer:
* List all of the files in /bin that start with the letter 'c': `ls /bin/c*`
* List all of the files in /bin that contain the letter 'a': `ls /bin/*a*`
* List all of the files in /bin that end with the letter 'o': `ls /bin/*o`
* BONUS: List all of the files in /bin that contain the letter 'a' or 'c'. (This was not covered in the lesson): `ls *[ac]*`
- Print the contents of
sequences-copy.fqto the screen.
Answer: cat sequences-copy.fq
- Use the
headcommand to keep only the first two sequences of this file.
Answer: head -n 2 sequences-copy.fa
- The last two lines of the file
sequences-copy.farepresent a protein sequence. Use thetailcommand to take those two lines and redirect them into a new file calledprotein.fa.
Answer: tail -n 2 sequences-copy.fa > proetin,fa
- Use
grepto search for the pattermCAGCTin thesequences-copy.fafile. Use your shell knowledge to count how many times that pattern appears in the file. Now use themanpages to find out how you can count using thegrepcommand.
Answer: grep CAGCT sequences-copy.fa | wc -l
`grep -c CAGCT sequences-copy.fa `