Forrest logo
back to the cp tool

cp:tldr:0547c

cp: Follow symbolic links before copying.
$ cp -L ${link} ${path-to-target_directory}
try on your machine

The command cp -L ${link} ${path-to-target_directory} is used to copy files or directories in Linux or Unix-like operating systems. Here's the breakdown of the command:

  • cp: This is the command to copy files or directories.
  • -L: This is an option for the cp command, which tells it to follow symbolic links (symlinks) and copy the files or directories they point to, rather than copying the symlinks themselves.
  • ${link}: This is the variable representing the source file or directory that needs to be copied. It can be an absolute or relative path to a file or directory.
  • ${path-to-target_directory}: This is the variable representing the destination directory where the source file or directory will be copied to. Again, it can be an absolute or relative path.

So, by executing this command, it will copy the file or directory pointed to by the symlink ${link} to the specified ${path-to-target_directory}. The -L option ensures that the file or directory being linked to is copied, rather than the symlink itself.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the cp tool