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 -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. -
Rename
sample_names.txt
totreatment_groups.txt
.Solution
mv sample_names.txt treatment_groups.txt
-
Within
Practice_L2
, create a new directory calledAnalysis
.Solution
mkdir Analysis
-
Copy
treatment_groups.txt
to the newly createdAnalysis
directory.Solution
cp treatment_groups.txt ./Analysis
-
List the contents of the
Analysis
directory.Solution
ls -l ./Analysis
-
Change directories to
Analysis
. What is the path toAnalysis
?Solution
cd Analysis pwd
-
Change to the
data
directory.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.fastq
into a new file calledLine1.txt
using keyboard shortcuts andnano
. -
Move
Line1.txt
toPractice_L2
using a relative file path.Solution
mv Line1.txt ..
-
Change to the
Practice_L2
directory.Solution
cd ..
-
Remove the
Analysis
directory.Solution
rm -i -r Analysis