I had the same problem in windows.
jcmd 6232 GC.heap_dump filename=IShp1.hprof
it ran, said file created, but a search of c drive couldn't find it.
Reran and got 'file exists'.
Tried with a path specified in filename, and a different file name,
jcmd 6232 GC.heap_dump filename=c:\temp\IShp2.hprof
This also got 'file exists'.
I conclude 'filename' is not being honored.
Presumably jcmd is writing some internally-specified unknown file name to some unknown location, when the 'filename' is specified.
Instead
jcmd 6232 GC.heap_dump c:\temp\isHpdmp1.hprof
works and writes the file to the specified location.
So presumably for *nix
something like
jcmd 6232 GC.heap_dump /opt/temp/myHd.hprof