What is the `GET` command in Ubuntu?

What is the GET command in Ubuntu? When I was trying out telnet, I accidentally typed in GET / too slowly, and it timed out, and I accidentally pressed Enter, and it ran the command GET.

The output was:

HTML>
<HEAD>
<TITLE>Directory /</TITLE>
<BASE HREF="file:/">
</HEAD>
<BODY>
<H1>Directory listing of /</H1>
<UL>
<LI><A HREF="./">./</A>
<LI><A HREF="../">../</A>
<LI><A HREF="bin/">bin/</A>
<LI><A HREF="boot/">boot/</A>
<LI><A HREF="cdrom/">cdrom/</A>
<LI><A HREF="dev/">dev/</A>
<LI><A HREF="etc/">etc/</A>
<LI><A HREF="home/">home/</A>
<LI><A HREF="lib/">lib/</A>
<LI><A HREF="lib32/">lib32/</A>
<LI><A HREF="lib64/">lib64/</A>
<LI><A HREF="libx32/">libx32/</A>
<LI><A HREF="lost%2Bfound/">lost+found/</A>
<LI><A HREF="media/">media/</A>
<LI><A HREF="mnt/">mnt/</A>
<LI><A HREF="opt/">opt/</A>
<LI><A HREF="proc/">proc/</A>
<LI><A HREF="root/">root/</A>
<LI><A HREF="run/">run/</A>
<LI><A HREF="sbin/">sbin/</A>
<LI><A HREF="snap/">snap/</A>
<LI><A HREF="srv/">srv/</A>
<LI><A HREF="swapfile">swapfile</A>
<LI><A HREF="sys/">sys/</A>
<LI><A HREF="tmp/">tmp/</A>
<LI><A HREF="usr/">usr/</A>
<LI><A HREF="var/">var/</A>
</UL>
</BODY>
</HTML>

What is this command?

When I run GET / HTTP/1.1, it displays http://www.i5.com/calacom at the end of the page... What is that website?

Edit:

man GET says:

LWP-REQUEST(1p)                                     User Contributed Perl Documentation                                    LWP-REQUEST(1p)

NAME
       lwp-request - Simple command line user agent

Seriously! I did not run the command inside telnet!

whereis GET shows GET: /usr/bin/GET /usr/share/man/man1/GET.1p.gz.

All GET commands were run on the terminal itself! Do not post answers talking about HTTP in telnet. I am not new to HTTP.


Solution 1:

It's indeed HTTP's GET method but not specific/related to telnet. GET simply sends a GET request and displays the output in STDOUT. When you do GET /, you're actually sending a GET request to your root folder. To test things, open any browser and simple type / in URL bar. Now inspect the elements and you'll notice the HTML of the page is same as what you got in terminal.

I developed a simple REST API to test things. This is how results look like:

$ GET localhost:8090
{
    "bookID": 2091,
    "title": "Dear Genius",
    "authors": "Ursula Nordstrom-Leonard S. Marcus-Maurice Sendak",
    "average_rating": 4.39,
    "isbn": 64462358,
    "language_code": "eng",
    "ratings_count": 518,
    "price": 2107
}

You can find the manual on lwp-request(1): Simple user agent - Linux man page. Quoting from there:

This program can be used to send requests to WWW servers and your local file system. The request content for POST and PUT methods is read from stdin. The content of the response is printed on stdout. Error messages are printed on stderr. The program returns a status value indicating the number of URLs that failed.