You would like to execute one or multiple commands on a remote Linux or Unix host and display report on your local machine.

ssh -P PORT USERNAME@IP "COMMAND'S"

Execute Single Command:

Display the Ram memory space from the remote system,

$  ssh -p 22 username@192.168.0.20 "free -m" 

enter the password,

Output:


    total       used       free     shared    buffers     cached
Mem:           992        695        297          0          6         28
-/+ buffers/cache:        660        331
Swap:         1999        897       1102


Execute Multiple Command:

Include disk space,

$ ssh -p 22 username@192.168.0.20 "free -m && df -h"

  total       used       free     shared    buffers     cached
Mem:           992        693        298          0          6         28
-/+ buffers/cache:        659        333
Swap:         1999        897       1102

Filesystem      Size  Used Avail Use% Mounted on
udev            492M  8.0K  492M   1% /dev
tmpfs           100M  340K   99M   1% /run
/dev/xvda1      7.8G  3.2G  4.2G  43% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            497M   32K  497M   1% /run/shm
none            100M     0  100M   0% /run/user
 


Save the Execution report in Local System:

$ ssh -p 22 username@192.168.0.20 "free -m && df -h" > /home/username/linux_report.txt


Verify the report,

$ cat  /home/username/linux_report.txt