Skip to content

Instantly share code, notes, and snippets.

@San3-Cod3
Created December 8, 2022 05:14
Show Gist options
  • Save San3-Cod3/dfc039cb2bb2da0a3a6852a71be76027 to your computer and use it in GitHub Desktop.
Save San3-Cod3/dfc039cb2bb2da0a3a6852a71be76027 to your computer and use it in GitHub Desktop.
speedtest-cli — results you care about, returned ~ all on a single line; w/o the faff.
#!/bin/bash
# create/place in: /home/YOU/ or /usr/bin/ # ( sudo needed for latter ) #
# chmod +x speedtest-cli_jq_json.sh #
# sudo apt-get install -y jq speedtest-cli #
# ˇ jq explained simply @ link below ˇ #
# https://puu.sh/JslQO/c0d473928e.png #
# ˇ usage: ˇ #
# ./speedtest-cli_jq_json.sh # ( if in: /home/YOU/ ) #
# speedtest-cli_jq_json.sh # ( if placed in: /usr/bin/ ) #
# ˇ how snippet looks once executed ˇ #
# https://puu.sh/JslST/397941d6ca.png #
read p d u < <(\
speedtest-cli --json \
| jq -r '[.ping, .download/1000000, .upload/1000000] | join(" ")'
)
printf 'Ping: %.02f ms || Download: %.02f Mbit/s || Upload: %.02f Mbit/s\n' "$p" "$d" "$u"
@San3-Cod3
Copy link
Author

ss (2022-11-23 at 04 44 00)
ss (2022-11-23 at 04 53 32)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment