Remote to server and run tmux in detached mode with pipe

I am trying to remote to server with ssh and run a tmux on the remote server with a command in detached mode. The command I want to run in tmux needs a pipe character.

I have tried escaping the | character with \ but that doesnt seem to do it.

My current command:

ssh [email protected] -C tmux -s -d MySession 'nc -l 10000 | zfs receive tank/remotepool'


  • Put the entire remote command in quotes so the nested quoted string will be processed properly.

    ssh [email protected] -C "tmux -s -d MySession 'nc -l 10000 | zfs receive tank/remotepool'"