Exercise 1

Perform the following tasks with the skills and knowledge you have gained.

Change the name of the subdirectory “four_exercises” within your “Linux” directory to “4_exercises”

  1. Make a backup of the “4_exercises” directory
  2. List the contents of the “4_exercises” directory
  3. Within the directory “4_exercises”
    1. Print the working directory.
    2. Print out to screen the phrase ‘the echo command allows me to print phrases to screen’.
    3. Copy the file “copy_this_file.txt” to the directory “to_me”
    4. Rename the directory “to_me” to “you”
    5. Delete the initial “copy_this_file.txt” file

Answers

Click on the below expandable boxes to view my solutions for the exercise. These are not the definitive solution but only examples of solutions. If your method works and you understand why then you have done it correctly.

Ensure you are in the correct directory before carrying out the below commands

cd ~/Linux/

Make a backup of the 4_exercises directory

cp -r 4_exercises 4_exercises_backup 

List the contents of the 4_exercises directory

ls 4_exercises

Within the directory 4_exercises

cd 4_exercises

Print the working directory

pwd
  1. Print out to screen the phrase ‘the echo command allows me to print phrases to screen’
echo “the echo command allows me to print phrases to screen”
  1. Copy the file copy_this_file.txt to the directory to_me
cp copy_this_file.txt to_me
  1. Rename the directory to_me to you
mv to_me you
  1. Delete the initial copy_this_file.txt file
rm copy_this_file.txt