Use the ping command to check your connection to a server.

For example, by entering this command in the terminal:

ping google.com

You can find out whether you can connect to Google and measure the response time.