##############
# Exercise 1 #
##############

# The objective of this exercise is to familiarize yourself with the most
# used commands (cd, ls, mkdir), move across the directory tree and see 
# the differences of using relative and absolute paths to refer to files.

# we make sure that we start this exercise in our home directory
cd

# this command shows us where we are in the directory tree
pwd

# we create a directory
mkdir pract_so/

# and another inside the previously created one
mkdir pract_so/WORK

# we enter in this directory
cd pract_so/

# we check were we are again
pwd

# we copy a directory and all its contents to our present working directory. We are using the environment variable $USER to refer to our user, whichever it is or $HOME to refer to our home directory whichever it is
cp -r $HOME/LINUX_CLI_EXERCISES/SEQS .

# we list the contents of the directory
ls

# we enter in the WORK directory
cd WORK

# check, if you want, were you are

# we link a program to here, if we want to keep the name, only the source file is needed as an argument
ln -s $HOME/LINUX_CLI_EXERCISES/clustalw2_sleep

# we link a file using an absolute path creating it with a different name
ln -s $HOME/pract_so/SEQS/LexA_all.fst LexA_all.fst_1

# we link a file using a relative path creating it with a different name
ln -s ../SEQS/LexA_all.fst LexA_all.fst_2

# we list the contents of the directory in a long format where we can see were the links point to
ls -l

# ASK OSCAR IF THIS IS CORRECT BEFORE CONTINUE

# we go to the parent directory
cd ..

# we go to the parent directory so now we are in our home (you don't believe me? check it!)
cd ..

# we change the name of the directory where we've been working
mv pract_so PRACT_SO

# we list the contents of our home directory so we can see that the name has change
ls

# we go to the WORK directory
cd PRACT_SO/WORK/

# we list the directory so we can see what has happened to our previously created links. One of them is not working. Do you understand why?
ls -l

# we change the name of the working file and  we remove the not working one.
# we can execute 2 independent commands in the same line using " ; "
mv LexA_all.fst_2 LexA_all.fst ; rm LexA_all.fst_1

# we go to our home directory
cd

