make copy of file and place in new directory using relative path

6,407

Solution 1

First: try to write the answer using absolute path, e.g.

cp /path/to/file.xyz /path/to/the/target/file.xyz

Second: in each directory you can find

. = this directory

.. = parent directory

Third: rewrite the former command using the . and .. dirs. Assuming the current dir is /path/to/ we can write:

cp ./file.xyz ../the/target/

Solution 2

Since this is an assignment I'm not going to give you the answer. But I will point out that every directory has two special directory links:

  • . (dot): "This directory"
  • .. (dot-dot): "The directory above"
Share:
6,407

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin almost 2 years

    i have been stuck on this question for my lab for linux class

    enter image description here

    • dhag
      dhag over 6 years
      Hi! Please edit your question to (1) replace the screenshot with text and (2) tell us what you tried.
    • G-Man Says 'Reinstate Monica'
      G-Man Says 'Reinstate Monica' over 6 years
      There are a couple of steps that come before #2: do some research (starting with a review of what you were taught in class) and then try to solve this yourself.