---
title: "Discussion on \" What Really Happens When You Run curl google.com on Linux?\" | Hashnode"
description: "Discussion on \" What Really Happens When You Run curl google.com on Linux?\". Trace curl google.com through bash execution, ELF linking, glibc NSS resolution, TCP handshakes, socket buffers, and Google 301 redirects on Linux."
url: "https://hashnode.com/posts/what-really-happens-when-you-run-curl-google-com-on-linux/6add92ffd4e3b250db5e28a9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [What Really Happens When You Run curl google.com on Linux?](https://asepsayyad007.hashnode.dev/what-really-happens-when-you-run-curl-google-com-on-linux?utm_source=hashnode&utm_medium=feed)

Trace curl google.com through bash execution, ELF linking, glibc NSS resolution, TCP handshakes, socket buffers, and Google 301 redirects on Linux.

Oct 25 · 23 min read · asepsayyad007.hashnode.dev  
Read the article

-   [#linux](https://hashnode.com/tag/linux)
-   [#devops](https://hashnode.com/tag/devops)
-   [#ubuntu](https://hashnode.com/tag/ubuntu)
-   [#cloud](https://hashnode.com/tag/cloud)
-   [#terminal](https://hashnode.com/tag/terminal)

## Written by

[Asep Sayyad](https://hashnode.com/@asepsayyad007)

@asepsayyad007 · Aurangabad

  
[View profile](https://hashnode.com/@asepsayyad007)

Linux • DevOps • Self-Hosting • Open Source

Linux • DevOps • Open Source | Building AiroDrop—an Apple-like ecosystem for iPhone users on Windows. Sharing real-world projects, automation, and engineering lessons.

## Responses 2

Markdown supported · ⌘↵ to post

[c-wind](https://hashnode.com/@c-wind)

[Oct 25](https://hashnode.com/posts/what-really-happens-when-you-run-curl-google-com-on-linux/6add92ffd4e3b250db5e28a9/comment/6ade01fc5819f19be2dda65b)

The strace in section 1 is the tell: read(0, "c", 1) means the shell already has decoded characters on the pts slave. A terminal emulator writes those bytes to the pty master; it does not push scan codes across /dev/pts. Scan codes die in the local keyboard stack (evdev), and over SSH the remote pty only sees the channel bytes. The rest of that section (alias/hash, PATH stat loop, clone + execve, parent in wait4) matches what I see.

Smaller one in the resolver section: \[NOTFOUND=return\] after mdns4\_minimal is not "try mDNS, then DNS if missing." nss-mdns returns UNAVAIL for non-.local names so glibc continues to dns, and NOTFOUND only for .local misses, which is why those stop instead of leaking to the upstream resolver. The 301 walk-through is the part that is easy to get wrong and this one doesn't: Location stays on the www host, still plain HTTP, and -L is what starts the second hop onto HTTPS.

[Asep Sayyad](https://hashnode.com/@asepsayyad007)

[Oct 25](https://hashnode.com/posts/what-really-happens-when-you-run-curl-google-com-on-linux/6add92ffd4e3b250db5e28a9/comment/6ade01fc5819f19be2dda65b#reply-6ade0fd1c49e4c03682d0e00)

Thanks for such a detailed read! The distinction between terminal input and keyboard scan codes is an important detail, and the explanation of how `nss-mdns` interacts with DNS makes the resolver section even more interesting. Glad you also found the HTTP-to-HTTPS redirect walkthrough accurate. Really appreciate you sharing these insights!
