Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
Tags
- RandomAccessFile
- tauri
- Rust
- React
- k3s
- podman
- podman compose
- Caddy
- Docker Compose
- getting started
- io
- vscode
- docker
- .dockerignore
- Java
- qwen3-coder-next
- dockerfile
- html canvas
- Let's Encrypt
- Vite
- FileChannel
- Ollama
- Webpack
- vim
- Typescript
- curl
- cli
- Thinking Mode
- compose
- glm-ocr
Archives
- Today
- Total
워로디스
curl 응답코드만 출력 본문
리눅스에서는?
curl을 사용할 때 응답 코드만 확인하려면 -o와 -s 옵션을 사용하여 출력 내용은 숨기고, -w "%{http_code}" 옵션을 사용하여 HTTP 응답 코드를 출력합니다.
명령어 예제
curl -s -o /dev/null -w "%{http_code}" https://example.com
옵션 설명
-s(--silent): 진행 상황이나 오류 메시지를 숨깁니다.-o /dev/null: 응답 본문을/dev/null로 보내어 출력하지 않습니다.-w "%{http_code}": 요청 후 HTTP 응답 코드를 출력합니다.
실행 예제 출력
200
위 예제는 https://example.com에 요청을 보내고 응답 코드(예: 200, 404)를 출력합니다.
윈도우즈에서는?
Windows에서 curl 명령어로 응답 코드만 확인하는 방법은 다음과 같습니다.
명령어 예제
curl -s -o NUL -w "%{http_code}" https://example.com
옵션 설명
-s(--silent): 진행 상황 및 오류 메시지를 숨깁니다.-o NUL: 응답 본문을 출력하지 않고NUL(Windows의/dev/null역할)로 보냅니다.-w "%{http_code}": 응답 후 HTTP 상태 코드를 출력합니다.
실행 예제 출력
200
이렇게 하면 https://example.com의 HTTP 상태 코드(예: 200, 404 등)만 출력됩니다.
'정리 > curl' 카테고리의 다른 글
| curl 출력 방식 (0) | 2026.02.06 |
|---|---|
| curl 을 이용한 파일 다운로드 (0) | 2026.02.06 |