- Login to O2 and start an interactive session.
Answer: ssh [email protected]
- Change directories into
unix-intro
.
Answer: cd unix-intro
- List the contents of the
other
directory. How many files are in the folder?
Answer: ls -l other
- Make a copy of the
sequences.fa
file and put it in theother
folder. Name this filesequences-copy.fa
.
Answer: cp other/sequences.fa other/sequences-copy.fa
- Change directories into
other
. List all theMov10
FASTQ files inraw_fastq
from your current directory without changing directories.
Answer:
ls -l ../raw-fastq/Mov10*
- Do each of the following using a single
ls
command 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.fq
to the screen.
Answer: cat sequences-copy.fq
- Use the
head
command 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.fa
represent a protein sequence. Use thetail
command to take those two lines and redirect them into a new file calledprotein.fa
.
Answer: tail -n 2 sequences-copy.fa > proetin,fa
- Use
grep
to search for the pattermCAGCT
in thesequences-copy.fa
file. Use your shell knowledge to count how many times that pattern appears in the file. Now use theman
pages to find out how you can count using thegrep
command.
Answer: grep CAGCT sequences-copy.fa | wc -l
`grep -c CAGCT sequences-copy.fa `