How to access Website using command-line from the Terminal

Penetration Testing Process often involves dealing with a variety of tools. These tools may be Command-Line based, GUI Based, readily available, and sometimes the pen tester may have to automate a set of commands.


GUI is not often possible, and you are not expected to rely on GUI/Gnome based tools for testing and exploitation practices. Suppose you have gained a shell on some machine and want to download an exploit, then the web browser is not available. In this tutorial, we are going to take a look at different tools which are useful while browsing the website using command-line from the terminal.


Netcat is a Swiss army knife for hackers, and It gives you a range of options to make your way through the exploitation phase.

Following is the way to access a webpage using GET method with netcat.
$ nc 80
GET / HTTP/1.1

Access with Netcat using the GET method

To access any contents like video, you can enter the following;

$ nc 80

You can change the ways to POST, OPTIONS, CONNECT as per your requirements. With HTTP/1.1, the connection doesn’t close after one request. To close the connection, enter;

$ Connection:close

Closing Connection

Alternatively, you can also use the following while accessing the webpage;

$ nc 80
GET / HTTP/1.1
Connection: close

The above commands will close the connection automatically after the page has been fetched from the webserver.


wget is another commonly used tool to access the webpage. You can use it to download anything placed on a particular web server.

$ wget

Accessing with wget


Curl is another powerful tool that is used to access the webpages in the command line environment. Enter the following command;

$ curl http://wwww.

Accessing with curl
Accessing with curl


w3m is a CLI based web browser. It lets you view the page source and access the webpage as if you were accessing it in any GUI browser.

You can install it by the following command;

$ sudo apt install w3m

To access a webpage enter;

$ w3m

Accessing with w3m
Accessing with w3m


Another useful command-line tool is lynx. You can install it by entering;

$ sudo apt install lynx
To access a webpage, enter;

$ lynx

Accessing with lynx
Accessing with lynx


Another handy text-based browser is browsh. It is still under construction. You can use by initiating the ssh connection by;

$ ssh

Then you can press CTRL+lto focus on the URL bar. Enter your query, and the Browsh will use Google as a search engine to search and output you the results on the command line.

Here’s an output of weather query using the Browsh.

Accessing with Browsh
Accessing with Browsh

Custom HTTP Request

You can also craft your custom HTTP request by entering the following command;

printf "GET /rnHost: google.comrnrn" | netcat 80

The HTTPs request will look like the following;
printf "GET /rnHost: google.comrnrn" | socat - 443

Custom HTTP request
Custom HTTP request


We have a variety of tools available to access the webpages from the terminal. The terminal also gives us the ability to customize the requests hence giving us enhanced capabilities. A pen tester must have some of these tools in the pocket during exploitation.

Leave a comment

Your email address will not be published. Required fields are marked *