FMeinicke's Wiki

Home

❯

Linux

❯

Convert symlink to hardlink or regular file

Convert symlink to hardlink or regular file

May 26, 20251 min read

  • linux/cp
  • cp/remove-destination
  • linux/ln
  • ln/f
  • linux/readlink

cp remove-destination ln f readlink

Source

  • https://stackoverflow.com/a/75263788/12780516
  • https://stackoverflow.com/a/13396140/12780516
ln -f $(readlink bar.pdf) bar.pdf                    # makes it a hardlink to the same file
cp --remove-destination $(readlink bar.pdf) bar.pdf  # makes it a completely separate regular file

Graph View

Created with Quartz v4.5.0 © 2025

  • GitHub