How do I reduce these two commands to one? I am connecting from my client to an x11vnc server and the two commands below already work. I just wish to do it in one step:first command:ssh -fNL 5901:localhost:5678 -i ~/.ssh/some_id_rsa rocky@example.comand second:vncviewer localhost:5901From reading the man page, it seems like the -via option might do it. Unfortunately, the man page leaves me very confused. For reference (not that I understand it) here is what my man page says:   -via gateway          Automatically create encrypted TCP tunnel to the gateway machine before con          nection, connect to the host through  that  tunnel  (TightVNC-specific).  By          default,  this  option  invokes SSH local port forwarding, assuming that SSH          client binary can be accessed as /usr/bin/ssh. Note that when using the -via          option,  the  host  machine name should be specified as known to the gateway          machine, e.g.  localhost  denotes  the  gateway,  not  the  machine  where          vncviewer  was  launched.  The environment variable VNC_VIA_CMD can override          the            default             tunnel             command             of          /usr/bin/ssh -f -L $L:$H:$R $G sleep 20.  The tunnel command is exe          cuted with the environment variables L, H, R, and G taken the values of  the          local  port number, the remote host, the port number on the remote host, and          the gateway machine respectively.
Establishing client VNC connection over SSH in one step (e.g., with the -via option)
ssh;vnc;ssh tunneling
This is what the man page is trying to say. I have the following setup.  vncviewer         .-,(  ),-.       __  _         .-(          )-.           gateway           vncserver   [__]|=|  ---->(    internet    )-------> __________ ------> ____   __   /::/|_|        '-(          ).-'        [_...__...]       |    | |==|                     '-.( ).-'                               |____| |  |                                                             /::::/ |__|NOTE: The above diagram was done using asciio.The vncviewer is running from my laptop. From my laptop I can run the following command and connect to the vncserver which is behind my router:$ vncviewer vncserver_host:0 -via mygateway.mydom.comThis will instantly connect me to the vncserver. This command is shown on my laptop which helps to show what the man page is trying to explain:/usr/bin/ssh -f -L 5599:vncserver_host:5900 mygateway.mydom.com sleep 20This is the command that vncviewer is automatically constructing when you use the -via gateway switch.including ssh configurationsYou can make use of the ~/.ssh/config file and put entries in this file like this:Host *IdentityFile ~/.ssh/id_dsaOr you can target a specific host like this:Host mygateway    User sam    HostName mygateway.mydom.com    IdentityFile ~/.ssh/someother_id_rsaThis will allow you to leverage the Host entries in this file like this:$ vncviewer vncserver_host:0 -via mygateway