Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to get upload and download speeds in Tmux's status line?

share|improve this question

1 Answer

You can call a shell script from tmux's status line, specifying your required interface like so:

set -g status-left '#[fg=blue]#(speed eth0)#[default]'

And place this script, speed1, in your $PATH:

#!/bin/bash

iface=$1
RXB=$(</sys/class/net/"$iface"/statistics/rx_bytes)
TXB=$(</sys/class/net/"$iface"/statistics/tx_bytes)
sleep 2 
RXBN=$(</sys/class/net/"$iface"/statistics/rx_bytes)
TXBN=$(</sys/class/net/"$iface"/statistics/tx_bytes)
RXDIF=$(echo $((RXBN - RXB)) )
TXDIF=$(echo $((TXBN - TXB)) )

echo -e "$((RXDIF / 1024 / 2))K/s $((TXDIF / 1024 / 2))K/s"

1. Can't remember where I found this...

share|improve this answer
Seems to work. Thank you @jasonwryan. – Sol Jun 22 '12 at 11:57
@Sol, you should mark the answer as accepted then ... – maxschlepzig Jun 23 '12 at 9:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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