How to merge video stream and two Stereo audio streams in 5.1 with a terminal command?
That depends on your video file format and possibly if you have a surround encoder.  Some file formats provide multiple audio channels that can be configured for different speakers, others rely on a Dolby encoding or similar to provide the speaker information in one audio stream.

Either use a file format that supports multiple independent audio tracks per speaker or use a Dolby (or some other system like MPEG Surround) surround encoder to encode the audio in to a single Dolby (or similar) stream that can be processed by a Dolby (or similar) receiver.

The encoding option would be the best one if you want to ensure compatibility with most players.  Encoders are available in most professional quality DVD/Bluray authoring software packages as well as for some better audio software packages.  You can alternately get a stand alone Dolby encoder, but licensing fees (1 time) for the encoder apply.