Apple - Removing the sleepimage file in /var/vm in macOS permanently

That file can be deleted - no need for -R but be sure to have the full path:

 sudo rm /private/var/vm/sleepimage

One you "delete it", the space will not be freed until the kernel and other processes close the file, so restart your Mac. The image file will be recreated next time you need to sleep - so if you had a HDD with that file contiguously allocated, you will make things worse when it's allocated non-contiguous blocks. SSD won't care either way.

I would focus on cleaning / relocating other files long term than this one.

Info in this answer has been extracted from this page.

The sleepimage file is protected by SIP, which needs to be disabled before deletion. Additionally, you need to turn off the mechanism which creates the sleepimage file to keep it from creating the file in the future.

Turn off hibernate mode (which may be reset during future system upgrades/updates:)

sudo pmset -a hibernatemode 0

Restart your machine and hold down Cmd-R to boot into recovery mode. When that loads, go to Utilities > Terminal, and enter the following to disable SIP:

csrutil disable

When your machine starts back up, go into terminal and remove the sleepimage. This time, it’ll work. You’ll also need to create a blank sleepimage file and make it unwritable, otherwise the full file will come back fairly quickly.

sudo rm -f /private/var/vm/sleepimage
sudo touch /private/var/vm/sleepimage
sudo chflags uchg /private/var/vm/sleepimage

Now boot back into recovery mode and re-enable SIP:

<s>csrutil enable</s>

When you’re back into MacOS, go into terminal one final time, and verify that the sleepimage has a size of 0 bytes:

ls -la /private/var/vm