Skip to content

1. Directory_exercises

gitarunprasanna83 edited this page Jul 18, 2019 · 10 revisions
  1. Open Terminal

OpenTerminal

  1. Find the path of current working directory -> type pwd
  2. List the contents of the directory -> type ls

ls_output

  1. Travel to the path of 00_DATA -> cd /path_to/../../00_DATA

  2. List the contents of the directory -> type ls

  3. type ls -altr -> record your observation

  4. Find the details of parameters -a,l,t,r (man ls, to quit type q at :)

  5. type ls -altrh -> record your observation

  6. type mkdir 1_Dir -> Make Directory

  7. Enter inside 1_Dir -> cd ./1_Dir

  8. Exit 1_Dir -> cd ../1_Dir

  9. Clear the clutter in screen -> type clear

  10. Copy genome fasta file into 1_Dir -> cp GCF_000005845.2_ASM584v2_genomic.fna ./1_Dir

  11. List the content of 1_Dir

  12. Enter inside 1_Dir -> cd ./1_Dir

  13. Rename the file name to a neat version -> mv GCF_000005845.2_ASM584v2_genomic.fna E.coli_genome.fa

    Similarly copy and move GCF_000005845.2_ASM584v2_protein.faa to E.coli_proteome.fa

  14. Make one more directory named “Dir_2” inside this directory

  15. Exit to 00_DATA directory -> cd ../../

  16. Rename the directory 1_Dir to Dir_1 -> mv 1_Dir Dir_1

  17. List the content of Dir_1

  18. Remove Dir_1 -> rm -rf ./Dir_1/Dir_2; If you are inside Dir_1, then rm -rf Dir_2

Summary:

You opened a terminal -> checked the path -> listed its contents -> made a directory -> copied a file into new directory -> renamed the file -> renamed a directory -> created a subdirectory -> removed the subdirectory

pwd – Present working directory

ls – list

cd – Change Directory

mkdir – make directory

rm – remove

mv – move

cp – copy

clear – clear the screen

Now, check your learning with self-graded quiz !

Quiz 1

Once complete, move to next section 2. File operations

Clone this wiki locally