When working in a clustered Linux environment containing two or more servers, it is not uncommon to switch back and forth between the hosts. Even if it’s running one command.
SSH is a powerful tool, it can do allot more than act as remote shell or tunnel traffic. One of those features is sending a command string to the server and fetching the output.
Assuming that you have access and privileged user on the remote server, the command works as follows
~$ ssh [email protected] "netstat -tulpna|grep -i established"
[email protected]'s password: *****
For an even more awesome experience, consider authenticating using ssh-key’s.