Skip to content

u/boccaff

In this archive from Feb 2016 to Mar 2024

0
posts
6
comments
0
media
11
score

There is one from i3blocks https://github.com/vivien/i3blocks/blob/master/scripts/bandwidth

I've adapted some lines in the end of the script do display correctly the output in MB/s.

# shift by 10 bytes to get KiB/s. If the value is larger than
# 1024^2 = 1048576, then display MiB/s instead

# incoming
echo -n "$INLABEL"
rx_kib=$(( $rx_rate >> 10 ))
if [[ "$rx_rate" -gt 1048576 ]]; then
    	printf '%sM' "$(($rx_kib / 1024))"
else
    echo -n "${rx_kib}K"
fi

echo -n " "

# outgoing
echo -n "$OUTLABEL"
tx_kib=$(( $tx_rate >> 10 ))
if [[ "$tx_rate" -gt 1048576 ]]; then
    	printf '%sM' "$(($tx_kib / 1024))"
else
  echo -n "${tx_kib}K"
fi

edited for formating

1 points

End of this list.

Back to top

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.