How to measure internet speed from terminal?

If you want to test your internet connection, but you only have a terminal (via ssh) you can use the following commands

sudo apt-get install speedtest-cli
speedtest-cli

If you want to see only the servers from Romania, for example:

speedtest-cli --list | grep Romania

To use a certain server use:

speedtest-cli --server [server id]

where server id is a number from the list of servers

Solved: perl: warning: Setting locale failed.

When I’m trying to connect to my Linux box from macOS Terminal I got the following error:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Solution:

Open a new Terminal on macOS and edit the file ~/.bash_profile

Add the following lines:

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8