Question: What is the most direct way to convert a symlink into a regular file (i.e. a copy of the symlink target)?

Suppose `filename` is a symlink to `target`. The obvious procedure to turn it into a copy is:

```
cp filename filename-backup
rm filename
mv filename-backup filename

```

Is there a more direct way (i.e. a single command)?

Answer: 
Just a rehash of other's answers, but adding the "sanity check" to ensure the link passed in is actually a symbolic link:

```
removelink() {
  [ -L "$1" ] && cp --remove-destination "$(readlink "$1")" "$1"
}

```

This is saying that if the file is a symbolic link, then run the copy command.
Another approach if you find yourself doing this often is adapting kbrock's answer into a shell script and putting it into /usr/bin/. Something along the lines of:

```
if [ $# -ne 1 ] 
then
  echo "Usage: $0 filename"
  exit 1
fi
[ -L "$1" ] && cp --remove-destination "$(readlink "$1")" "$1"

```

chmod +x it, and then just run it as a normal command.