Working with Files and Directories

15 minutes
  • 2 Learning Objectives

About this Hands-on Lab

The ability to manage and work with files and directories is foundational to performing general tasks in the Linux command line. In this hands-on lab, you will be tasked with creating and removing files and directories as well as modifying existing files and directories.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create and Remove Files and Directories
  • Create 2 files in /opt/work/content:
    • template01
    • template02
  • Create a new directory called backup in /opt/work/.
  • Copy the directory /opt/work/project_alpha and all its contents to /opt/work/backup/.
  • Remove the directory /opt/work/project_alpha and all its contents.
Modify Existing Files and Directories
  • Move the file /opt/work/marketing/welcome.txt to /opt/work/content/.
    • Use a text editor to update the contents of /opt/work/content/welcome.txt. Replace the string marketing team with content team.
    • Rename the /opt/work/marketing directory to be /opt/work/marketing_east.
    • Use the echo command and output redirection to overwrite the file /opt/work/marketing_east/strategy.txt with the following line – This document is a placeholder for the east cost marketing branch.

Additional Resources

You work for a content creation company as a Linux administrator and have been tasked with creating, removing, and modifying some files and directories for the various teams within the company.

First, you will need to create some files that will be used as templates. Then, you need to back up the project_alpha directory and perform any necessary cleanup.

Next, you need to move the welcome.txt file from its current home in the marketing directory to the content directory and update the file content with the text provided. Then, you will need to rename the marketing directory in order to suit the newly branded team and update the file strategy.txt within that directory using the placeholder message provided.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?