C.W.K.
Stream
Lesson 03 of 13 · published

curl 기초

~12 min · curl, http, headers, redirect

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

HTTP 의 스위스 군용 칼

curl 이 HTTP, HTTPS, FTP, SCP, SFTP, 다른 수십 프로토콜 말함. 매일 HTTP 에 사용 — 가져오기, redirect 따라가기, header 설정, JSON 보내기. 작은 flag 셋 마스터하면 curl 이 터미널의 API 디버깅 90% 처리.

외울 가치 있는 flag

Flag용도
-vVerbose — request/response header 보여줌
-IHEAD 만 — header 가져오고 body 건너뛰기
-L3xx redirect 따라감
-o fileBody 파일에 쓰기
-OURL 의 파일이름으로 저장
-sSilent (progress 없음)
-S-s 와 함께도 에러 보여줌
-w '%{http_code}'상태 코드 출력 (스크립트 좋음)
--max-time N초 단위 hard timeout

Code

일상 curl 레시피·bash
# Just fetch a page
curl https://example.com

# Headers only
curl -I https://example.com

# Verbose — see everything
curl -v https://example.com

# Follow redirects, save to file with original name
curl -LO https://example.com/file.tar.gz

# Quiet health check that returns just the status code
curl -sS -o /dev/null -w '%{http_code}\n' https://example.com

# With a timeout
curl --max-time 5 -sS https://possibly-slow.example.com

External links

Exercise

신뢰하는 URL 골라. curl -I https://... 로 header 만 봐. 그다음 curl -sS -o /dev/null -w 'http=%{http_code} time=%{time_total}s\n' https://... 와 metric 메모. 이 4-flag 패턴이 터미널 쪽 uptime 체크.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.