A couple of comments on this.
A symbolic link itself can't be compressed. A symbolic link is just a pointer to another file, and doesn't contain any data itself (other than the target file name), so there isn't really anything to compress.
If this is on Linux, compress
may not be your best compression tool to use. I say this because it is not installed by default on many linux distros because of historic patent issues with the underlying LZW algorithm, and because other tools like gzip
offer better compression ratios.
For many linux tools, if you try and use them on a symbolic link, they will follow the link and operate on the target file. This does not apply to gzip and bzip2, though - these tools produce an error when you try and compress a symbolic link. I haven't tested this, but expect compress to act in the same way. If you want to compress the destination file, you would therefore have to specify its name as argument for most compression tools.
To answer your question:
Is the symbolic link just "sfile" or does the entire directory need to be executed as well?
This depends on your current working directory. If you are in the /root directory, either usage ("/root/sfile" or just "sfile") will work. If you are in a different directory, you will have to specify the full path ("/root/sfile"). If you're not doing this interactively (i.e. are doing it from a script, or answering an academic question), it's always better to specify the full path to be safe.
Regarding your proposed solution:
What I THINK it is:
compress -v -f -r /root/sfile
The "-v" option will display the compression ratio as requested. The "-f" will force compression, even if the compressed file isn't smaller than the original. If you are compressing a regular file, and this is what you want, by all means use it. I don't believe this will work on a symbolic link, though. I'm not sure what the "-r" option is mean to do?
I hope this helps!