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.
-
Let's navigate our files using the command line. Begin in your home directory.
-
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 ~ -
Change directories to
Practice_L2/.Solution
cd ./Practice_L2 -
List the contents of
Practice_L2. If there are files, when were they last modified and what is the file size?Solution
ls -lhThe
-lhflag 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. -
Rename
sample_names.txttotreatment_groups.txt.Solution
mv sample_names.txt treatment_groups.txt -
Within
Practice_L2, create a new directory calledAnalysis.Solution
mkdir Analysis -
Copy
treatment_groups.txtto the newly createdAnalysisdirectory.Solution
cp treatment_groups.txt ./Analysis -
List the contents of the
Analysisdirectory.Solution
ls -l ./Analysis -
Change directories to
Analysis. What is the path toAnalysis?Solution
cd Analysis pwd -
Change to the
datadirectory.Solution
cd ../data -
List the contents of
data.Solution
ls -
View
A_R1.fastq.Solution
less A_R1.fastq -
Copy and paste the first line of
A_R1.fastqinto a new file calledLine1.txtusing keyboard shortcuts andnano. -
Move
Line1.txttoPractice_L2using a relative file path.Solution
mv Line1.txt .. -
Change to the
Practice_L2directory.Solution
cd .. -
Remove the
Analysisdirectory.Solution
rm -i -r Analysis