How Do I Copy a Symbolic Link in Linux?
Contents

Use cp -P (capital P) to never traverse any symbolic link and copy the symbolic link instead. This can be combined with other options such as -R to copy a directory hierarchy — cp -RL traverses all symbolic links to directories, cp -RP copies all symbolic links as such.

-L, –dereference Follow symbolic links when copying from them. With this option, cp cannot create a symbolic link. For example, a symlink (to regular file) in the source tree will be copied to a regular file in the destination tree.

Symbolic Link to Link

If you use this option when copying symbolic links it will create a link to the link itself. … This is because the -s option can only make relative symbolic links only in the current working directory. The option to copy directories and folders recursively is -r, -R or –recursive.

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest