0
0
Linux CLIscripting~5 mins

curl for HTTP requests in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is curl used for in the command line?

curl is a tool to send and receive data from URLs using various protocols like HTTP. It helps you talk to websites or APIs from the terminal.

Click to reveal answer
beginner
How do you make a simple GET request to https://example.com using curl?

Use the command: curl https://example.com. This fetches the webpage content and shows it in the terminal.

Click to reveal answer
intermediate
What option do you use with curl to send data with a POST request?

Use -d or --data followed by the data string. For example: curl -d "name=John" https://example.com sends a POST request with data.

Click to reveal answer
beginner
How can you save the output of a curl request to a file?

Use the -o option followed by the filename. Example: curl https://example.com -o page.html saves the content to page.html.

Click to reveal answer
intermediate
What does the -I option do in curl?

The -I option fetches only the HTTP headers from the server, not the full content. Useful to check status or server info.

Click to reveal answer
Which curl command fetches only HTTP headers from a URL?
Acurl -X POST https://example.com
Bcurl -d https://example.com
Ccurl -I https://example.com
Dcurl -o https://example.com
How do you send form data "name=Anna" with a POST request using curl?
Acurl -d "name=Anna" https://example.com
Bcurl -X GET https://example.com
Ccurl -I https://example.com
Dcurl -o data.txt https://example.com
What does curl https://example.com -o file.html do?
ADeletes <code>file.html</code>
BSends a POST request
CFetches only headers
DSaves the webpage content to <code>file.html</code>
Which protocol is NOT supported by curl?
AHTTP
BSSH
CSMTP
DFTP
What is the default HTTP method used by curl if none is specified?
AGET
BPOST
CPUT
DDELETE
Explain how to use curl to send a POST request with data and save the response to a file.
Think about how to send data and where to put the response.
You got /4 concepts.
    Describe how to check only the HTTP headers of a website using curl and why this might be useful.
    Headers tell you about the server response without the full page.
    You got /3 concepts.