• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Copy A Symbolic Link

November 27, 2020

Here’s how to copy a symbolic link which is also known as a soft link from one directory to another. A regular copy command will not work. You will need to use the -P option to copy the symbolic link from one directory to another. If omitted, the symbolic links will not be copied.

cp -P /directory1/* /directory2/

cp -P /directory1/* /directory2/

How to create a symbolic link.

ln -s sourcefile myfile
ln -s /path/to/file myfile

ln -s sourcefile myfile ln -s /path/to/file myfile

Here are the man pages for ln and for cp.

Filed Under: Linux Tagged With: copy, cp, create, link, ln, symbolic

Search This Website

Subscribe Via Email

  • Home
  • About
  • Archives

Copyright © 2023