I have done some research but I have not found a good solution yet. I am looking for a simple program which shows me CPU/memory usage of remote Linux (Slackware) machines (20-30) to which I can login via passwordless ssh. I do not want to install any software on the machines. I just want something like: - ssh into every machine - run e.g. top - return reduced output (only CPU/memory usage) - nicely align this into a table - update the status every e.g. 2 seconds

I do NOT need to log anything or get any notifications of events. I just want this program for quick checks.

I already found the program "dtop" from clusterit but it won't run on my machine (Ubuntu 16.04) - giving me seg faults. And it does not seem to be maintained any longer (https://github.com/garbled1/clusterit).

I would be happy for any recommendations! Thanks in advance!

  • 1
    Depending on what details exactly you need, a simple shell script reading them from /proc//sys etc. and reducing them via sed/awk could do the trick. Take e.g. a look at /proc/stat for CPU and /proc/meminfo for memory usage – from what you wrote that could be all you need :)
    – Izzy
    Jul 10, 2019 at 19:19
  • 1
    Hey @Izzy, this sounds like a good idea. I will give it a try soon and post the outcome here :)
    – jamble
    Jul 11, 2019 at 10:35

1 Answer 1


So I hacked together a solution from various places, which works for me. I actually forgot, which sources I used - please tell me, if you feel I should link a post/website! I use the following script.



declare -a addresses
declare -a cpu_last
declare -a cpu_last_sum
declare -a cpu_usage

# read in the list of addresses to ssh in
while IFS= read -r line
done < "$input"

while :; do
  for i in "${!addresses[@]}"; do

    # Get the first line with aggregate of all CPUs 
    cpu_now=($(ssh ${addresses[$i]} head -n1 /proc/stat)) 

    # Get all columns but skip the first (which is the "cpu" string) 
    # Replace the column seperator (space) with + 
    cpu_sum=$((${cpu_sum// /+})) 
    # Get the delta between two reads 
    cpu_delta=$((cpu_sum - cpu_last_sum[$i])) 
    # Get the idle time Delta 
    cpu_idle=$((cpu_now[4]- cpu_last[$i])) 
    # Calc time spent working 
    cpu_used=$((cpu_delta - cpu_idle)) 
    # Calc percentage 
    cpu_usage[$i]=$((100 * cpu_used / cpu_delta)) 

    # Keep this as last for our next read 

  # print the results
  for i in "${!addresses[@]}"; do
    printf "${addresses[$i]}: ${cpu_usage[$i]}     \n"

  # Wait a second before the next read
  sleep 1 

  # clear the previous lines
  for i in "${!addresses[@]}"; do
    tput cuu1 # move cursor up by one line


There is probably lots of room for improvements. I would be thankful for any suggestions!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.