From a bash terminal, I want to log-in to a computing node and execute some command, for example, I do this to check the running jobs
ssh -t node1 'top -bn1 | grep R | grep -v top'
This logins to node1
and runs the top
command and grep desired output.
Now I want to check the memory load of the node. I have taken this code from here https://unix.stackexchange.com/questions/119126/command-to-display-memory-usage-disk-usage-and-cpu-load
free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
Now, I can not just do
ssh -t node1 '<above command>'
as there are multiple quote that will affect the command. Is there a way to execute the above command?