Unix Basics: Quick Review ========================= ls -- list contents cd -- change directory mkdir -- make a directory rm -- use caution, it is easy to delete more that you would like head -- prints the top few lines to the terminal window tail -- prints the last few lines to the terminal window sort -- sorts the lines uniq -- prints the unique lines grep -- filnds the lines that contain a pattern wc -- counts the number of lines, characters and words mv -- move files cp -- copy files date -- returns the current date and time pwd -- return working directory name ssh -- remote login scp -- remote secure copy ~ -- represents your home directory man [command] -- manual page for the command man ls try: ls -l ls -lt you can string more than one command together with a pipe (|) , such that the output of the first command is received by the second command. ls -lt | head you can string more than one command together with a semi-colon (;) , such that the commands run sequentially, but that output does not get passed into the next command. date; some program command ; date you can redirect the output of a command into a file grep PATTERN > PATTERN.txt you can append the output of a command to a file grep PATTERN2 >> PATTERN.txt you can redirect stderr to a file command 2> filename you can redirect the output (stdout) and stderr to a file command &> filename text editors: text wrangler is a good app to start with. =============== Unix Problem Set ================ Using your text editor create a fasta file with a few of your favorite sequecnes and name it sequences.fasta. Make sure it ends up in the proper directory, locally or remotely. This is fasta file format: >seqName description ATGGCGTCTTGGCCTTAAAAGCTC 1. Log into your machine or account. 2. What is the full path to your home directory? 3. Go up one directory? - How many files does it contain? - How many directories? 4. Without using a text editor examine the contents of the file sequences.fasta. - How many lines does this file contain? - How many characters? (Hint: check out the options of wc) - What is the first line of this file? (Hint: read the man page of head) - What are the last 3 lines? (Hint: read the man page of tail) - How many sequences are in the file? (Hint: use grep) 5. Rename sequences.fasta to something more informative of the sequences the file contains. (Hint: read the man page for mv) 6. Create a directory called fasta. (Hint: use mkdir) 7. Copy the fasta file that you renamed to the fasta directory. (Hint: use cp) 8. Verify that the file is within the fasta directory. (Hint: use ls fasta/) 9. Delete the the original file that you used for copying. (Hint: use rm, be careful) 10. Read the man page for rm and cp to find out how to remove and copy a directory. 11. Print out your history and redirect it to a file called unixBasics.history.txt 12. In /home/pfb2013/data there is a file called: cuffdiff.txt - look at the first few lines of the file - sort the file by log fold change 'log2(fold_change)', from highest to lowest, and save in a new file in your directory called sorted.cuffdiff.out - sort the file (log fold change highest to lowest) then print out only the first 100 lines. Save in a file called top100.sorted.cuffdiff.out - Sort the file, print only first column. Get a unique list of the genes, then print only the top 100. Save in a file called differentially.expressed.genes.txt |
Comments are closed.