Skip to content

Lesson 2 Practice

The instructions that follow were designed to test the skills you learned in Lesson 2. Thus, the primary focus will be navigating directories and manipulating files.

  1. Let's navigate our files using the command line. Begin in your home directory.

  2. Copy the Practice_L2 directory (/data/Practice_Sessions/Practice_L2) and all of its contents to your home directory.

    Solution

    cp -r /data/Practice_Sessions/Practice_L2 ~   
    

  3. Change directories to Practice_L2/.

    Solution

    cd ./Practice_L2    
    

  4. List the contents of Practice_L2. If there are files, when were they last modified and what is the file size?

    Solution

    ls -lh    
    

    The -lh flag will allow you to obtain a list of directory content in long format, which provides information including the date the file was last modified and the file size.

  5. Rename sample_names.txt to treatment_groups.txt.

    Solution

    mv sample_names.txt treatment_groups.txt    
    

  6. Within Practice_L2, create a new directory called Analysis.

    Solution

    mkdir Analysis    
    

  7. Copy treatment_groups.txt to the newly created Analysis directory.

    Solution

    cp treatment_groups.txt ./Analysis    
    

  8. List the contents of the Analysis directory.

    Solution

    ls -l ./Analysis    
    

  9. Change directories to Analysis. What is the path to Analysis?

    Solution

    cd Analysis  
    pwd    
    

  10. Change to the data directory.

    Solution

    cd ../data    
    

  11. List the contents of data.

    Solution

    ls    
    

  12. View A_R1.fastq.

    Solution

    less A_R1.fastq    
    

  13. Copy and paste the first line of A_R1.fastq into a new file called Line1.txt using keyboard shortcuts and nano.

  14. Move Line1.txt to Practice_L2 using a relative file path.

    Solution

    mv Line1.txt ..    
    

  15. Change to the Practice_L2 directory.

    Solution

    cd ..    
    

  16. Remove the Analysis directory.

    Solution

    rm -i -r Analysis