Proxy locations

Europe

North America

South America

Asia

Africa

Oceania

See all locations

Network statusCareers

How to Use a Terminal to Test Oxylabs’ Products

If you’ve never had to use your computer’s terminal, also known as the command prompt, you’re in the right hands. 

This in-depth guide will teach you the basics of using a terminal on Windows, macOS, and Linux machines. You’ll also learn how to set up your terminal with the curl library and use it to test Oxylabs’ solutions, including Residential Proxies, Datacenter Proxies, and Scraper APIs. So, let’s get the ball rolling!

Question

What is a terminal? 

The computer’s terminal is a built-in application that allows users to interact with their computers by running commands, scripts, and programs. It’s commonly called the command-line interface, as it’s a text-based interface that takes commands and hands them over to the operating system for execution.

For instance, just like you can copy and paste files using your computer’s cursor, you can do the same in the terminal with commands. You’re most likely used to a graphical user interface, like a web browser, for example, where you can tell your computer to execute specific tasks. The terminal, on the other hand, bypasses any graphical elements and controls the computer directly. These are just a few examples, and the terminal’s functionalities are endless.

1. Find the terminal on your computer

Let’s start by locating and opening the terminal application on your computer.

Windows computers

For simplicity, use the Command Prompt instead of PowerShell on Windows. Open Windows Search and look for Command Prompt or cmd:

Using Windows Search to find the terminal

Launch the Command Prompt application, and you should see a similar window:

Windows terminal

Helpful commands for using the Windows terminal:

Shortcut/command Description
Ctrl and Mouse Wheel UP
Ctrl and Mouse Wheel DOWN
Hold Ctrl and scroll your mouse wheel up or down to zoom the screen in or out.
dir /ad /b Enter this in your terminal to list the folders in the current directory.
cd Enter this in your terminal to navigate to a specific folder. For example, cd documents/projects.

macOS computers

On macOS computers, the terminal is simply called the Terminal.app.

Use the Launchpad or press Command and Spacebar (⌘ + ␣) on your keyboard to open up the Spotlight Search. Then, search for Terminal:

Using macOS Spotlight Search to find the terminal

Once you hit Enter to open the Terminal, you should see a similar window:

macOS terminal

Helpful commands for using the macOS terminal:

Shortcut/command Description
Cmd and +
Cmd and -
Press the Command key and the + or - sign on your keyboard together to zoom the screen in or out.
ls Enter this in your terminal to list the folders in the current directory.
cd Enter this in your terminal to navigate to a specific folder. For example, cd documents/projects.

Linux distributions

On Linux machines you can access the terminal by opening the Activities window and searching for Terminal or its synonyms (cmd, command prompt, shell). Depending on your Linux distribution and its version, this process may be different.

Helpful commands for using the Linux terminal:

Shortcut/command Description
Control and SHIFT and +
Control and -
Press the Control key, SHIFT, and the + or - sign on your keyboard to zoom the screen in or out.
ls Enter this in your terminal to list the folders in the current directory.
cd Enter this in your terminal to navigate to a specific folder. For example, cd documents/projects.

2. Prepare the terminal to send web requests

The terminal by itself can’t communicate via the internet with websites or APIs. Hence, you need an additional tool that can send web requests.

What is curl?

curl is a command-line tool that allows users to communicate with websites and APIs directly from the computer's terminal. It’s similar to how a web browser sends requests, but it’s significantly simpler and doesn't actually function as a web browser. When it comes to Oxylabs’ products, you can use curl to quickly test how proxies and Scraper APIs work.

Check if curl is installed

curl must be installed on the computer as an additional package. To check if you already have curl on your device, run the following command in your terminal:

curl --version

If curl is on your computer, no errors will be displayed. When you run the curl --version command, you should see the curl version and its release date as highlighted in green in this screenshot:

Checking the curl version in the terminal

Install curl on Windows

curl comes officially pre-bundled with computers running Windows 10 version 1804 and later releases, including Windows 11. 

When curl isn’t found on your computer, you can install it yourself by downloading curl from curl.se/windows. Please ensure that you select the appropriate architecture of the tool for your computer, either 64-bit, 64-bit (ARM64), or 32-bit.

For other methods to install curl on Windows, refer to the official curl documentation.

Install curl on macOS

Typically, computers running macOS come with a pre-installed curl package.

If curl isn’t found on your computer or you want to install a newer version, it’s highly recommended to use a package manager like Homebrew. It simplifies the installation process and handles dependencies automatically.

Install Homebrew by running the following command in your terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Alternatively, you can download the .pkg installer from Homebrew’s GitHub. Scroll to the bottom of the page until you see a section called Assets, then download and run the file that ends with .pkg.

Once you have Homebrew ready, run the command shown below in your terminal to install curl:

brew install curl

After that, paste and run the following lines in your terminal to make the newly installed curl the default one:

echo 'export PATH="$(brew --prefix)/opt/curl/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Install curl on Linux

Generally, many Linux distributions come with curl pre-installed; however, it may not be the case for you. If curl isn’t installed, you may find success by using the distribution's package manager to install curl.

For Debian and Ubuntu, you can use the below command in your terminal:

sudo apt install curl

If you’re using Fedora, Arch Linux, or other Linux distributions, head to the official curl documentation to find the steps for installing curl.

3. Run a web request with curl

Once curl is ready and you have acquired your Oxylabs product credentials for authentication, you can start using curl for testing or scripting. Below, you can find curl integration guidelines for Oxylabs proxies and scrapers.

Here’s how you can send a test request without using a proxy server:

curl "https://ip.oxylabs.io"

After pressing Enter to execute this command, you should see your network’s IP address in the output.

Residential and Mobile Proxies

Proxy type: HTTP, HTTPS, or SOCKS5

Proxy address: pr.oxylabs.io

Proxy port: 7777

Using the above proxy settings, you can set up curl to run requests through your Residential or Mobile Proxies via a random country. You may also use country-specific entries by replacing the proxy address with, for example, us-pr.oxylabs.io and the proxy port with 10000 to connect to a proxy server located in the United States. Visit the documentation to see the full list of country-specific entries for Residential and Mobile Proxies.

Now, let’s see the curl code for making a request using Residential or Mobile Proxies:

curl "https://ip.oxylabs.io" -U "customer-USERNAME:PASSWORD" -x "pr.oxylabs.io:7777"

Once you replace the USERNAME and PASSWORD values with your proxy credentials and run the code in your terminal, curl will use your proxy to send a request to ip.oxylabs.io, which will return the IP address used for that request. You should see an IP address printed out, which, in our case, was 5.204.135.197:

Running the above curl command and checking the IP address in the output

Visit ip.oxylabs.io on your browser (without using a VPN service) and compare your actual IP address with the one displayed in the terminal. If the proxy setup works correctly, the IPs should differ, and you should see a different IP address printed out every time you run the code.

Enterprise Dedicated Datacenter Proxies

Proxy type: HTTP or SOCKS5

Proxy address: 1.2.3.4 (a specific IP address)

Proxy port: 60000

For Enterprise Dedicated Datacenter Proxies, you have to choose an IP address from your acquired proxy list. Head to the documentation to learn more. The curl code should look similar to this:

curl "https://ip.oxylabs.io" -U "USERNAME:PASSWORD" -x "1.2.3.4:60000"

Self-Service Dedicated Datacenter Proxies

Proxy type: HTTP, HTTPS, or SOCKS5

Proxy address: ddc.oxylabs.io

Proxy port: 8001

Self-Service Dedicated Datacenter Proxies work by referring to the port number, which represents the sequential number of an IP address in your acquired proxy list. Hence, the 8001 port will always pick the first IP address from your list. Visit the documentation to find out more. Here’s how your curl code should look:

curl "https://ip.oxylabs.io" -U "user-USERNAME:PASSWORD" -x "ddc.oxylabs.io:8001"

Shared Datacenter Proxies

Proxy type: HTTP

Proxy address: dc.pr.oxylabs.io

Proxy port: 10000

Shared Datacenter Proxies also support country-specific entries. For example, you can connect to a Germany-based proxy server by setting the proxy address to dc.de-pr.oxylabs.io and the port to 40000. Take a look at our documentation to learn more. Your curl code should look similar to the snippet below:

curl "https://ip.oxylabs.io" -U "customer-USERNAME:PASSWORD" -x "dc.pr.oxylabs.io:10000"

Web Unblocker

Proxy type: HTTP or HTTPS

Proxy address: unblock.oxylabs.io

Proxy port: 60000

When using Web Unblocker, you must ignore the SSL certificate. In curl, this can be done by specifying the -k or --insecure flag:

curl -k "https://ip.oxylabs.io/location" \
-U "USERNAME:PASSWORD" \
-x "unblock.oxylabs.io:60000"

Check out our extensive documentation to find more details about Web Unblocker.

Scraper APIs

To test Oxylabs’ Scraper APIs (SERP, E-Commerce, and Web) via curl, you must use predefined sources for specific target URLs. Head to the documentation of the respective API to see the available sources and other parameters.

For demonstration purposes, let’s use Web Scraper API. The following curl code snippet will print the HTML document of this scraping sandbox website:

curl --user "USERNAME:PASSWORD" \
'https://realtime.oxylabs.io/v1/queries' \
-H "Content-Type: application/json" \
-d '{"source": "universal", "url": "https://sandbox.oxylabs.io/products"}'

Notice that the target URL is provided in JSON format after the -d flag, which tells curl to send the following data to the API via a POST request. Moreover, you have to use an API endpoint to connect to Web Scraper API. You can see that the above code snippet uses the real-time integration method via the https://realtime.oxylabs.io/v1/queries endpoint.

How to use HTTP, HTTPS, and SOCKS5 protocols in curl?

By default, curl uses the HTTP protocol to connect to proxy servers. Depending on the proxy type you’ve acquired, you can use the more secure HTTPS or SOCKS5 protocol. For instance, Residential Proxies support all three protocols; hence, you can specify the HTTPS proxy protocol by adding https:// to the proxy address:

curl "https://ip.oxylabs.io" -U "customer-USERNAME:PASSWORD" -x "https://pr.oxylabs.io:7777"

Alternatively, the SOCKS5 protocol can be specified like this:

curl "https://ip.oxylabs.io" -U "customer-USERNAME:PASSWORD" -x "socks5://pr.oxylabs.io:7777"

Wrap up

If you’re interested to learn more about curl, check out our blog post on how to use curl with proxies to delve deeper into its functionalities. Furthermore, our documentation is a goldmine for any instructions on using Oxylabs proxies and scrapers, so don’t hesitate to surf around.

In case you’re looking for a simpler way to test Oxylabs’ Scraper APIs, head to the dashboard and navigate to Scraper APIs Playground. Here, you can easily enter your target URL, choose the desired API parameters, and send a request to retrieve scraped results. If you have any questions about Oxylabs products, feel free to contact our 24/7 Support Team via live chat or drop a line at support@oxylabs.io.

Please be aware that this is a third-party tool not owned or controlled by Oxylabs. Each third-party provider is responsible for its own software and services. Consequently, Oxylabs will have no liability or responsibility to you regarding those services. Please carefully review the third party's policies and practices and/or conduct due diligence before accessing or using third-party services.

Get the latest news from data gathering world

I'm interested

Get proxies for $8/GB