Using Absolute and Relative Paths

15 minutes
  • 2 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will practice using absolute and relative paths. Understanding the difference between absolute and relative paths is a critical component to working with files and directories in Linux.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Use Absolute Paths to Move the File
  1. Use cat and redirection to place the contents of the file Practice/Test/free into a new file named value.txt in your home directory.
    cat /home/cloud_user/Practice/Test/free > /home/cloud_user/value.txt
Use Relative Paths to Move the File
  1. Change to the /usr/share directory.
    cd /usr/share
  2. Use cat and redirection to place the contents of the file Practice/Test/sys/fs/xfs/stats/stats into the newly created file value.txt in your home directory.
    cat ../../home/cloud_user/Practice/Test/sys/fs/xfs/stats/stats >> ../../home/cloud_user/value.txt

Additional Resources

Your supervisor has asked you to demonstrate your expertise in using absolute and relative paths by executing a couple of scenarios.

From your home directory:

Use cat and redirection to place the contents of the file Practice/Test/free into a new file named value.txt in your home directory using only absolute paths.

cat [PATH_TO_FILE] > [PATH_TO_HOME]/value.txt

From the /usr/share directory:

Use cat and redirection to place the contents of the file Practice/Test/sys/fs/xfs/stats/stats into the newly created file value.txt in your home directory using only relative paths.

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.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?