Linux

[Linux] curl 명령어

IT-PAPA 2023. 3. 22. 22:05
728x90
반응형

리눅스 curl 명령어는 인터넷 프로토콜(HTTP, FTP 등)을 사용하여 데이터를 전송하거나 받는 유틸리티 명령어입니다. 

curl 명령어는 많은 옵션을 지원하며, 이를 사용하여 데이터 전송 방식, 인증, 요청 메소드 등을 설정할 수 있습니다. 

아래는 curl 명령어의 일부 주요 옵션과 설명입니다.

옵션 설명 예시
-X HTTP 요청 메서드를 지정합니다. curl -X POST https://example.com/api
-H HTTP 요청 헤더를 추가합니다. curl -H "Authorization: Bearer 12345" https://example.com/api
-d HTTP POST 요청 시 데이터를 추가합니다. curl -X POST -d "username=johndoe&password=12345" https://example.com/login
-o 출력 파일을 지정합니다. curl -o output.html https://example.com
-L HTTP 리디렉션을 따릅니다. curl -L https://example.com
-u 인증 정보를 추가합니다. curl -u johndoe:password https://example.com/api
-s 진행 상황을 출력하지 않습니다. curl -s https://example.com
-v 자세한 정보를 출력합니다. curl -v https://example.com

 

curl 의 다양한 쓰임새

  • HTTP: curl https://www.example.com
  • HTTPS: curl https://www.example.com
  • FTP: curl ftp://ftp.example.com
  • SCP: curl scp://example.com/file.txt
  • SMTP: curl smtp://mail.example.com
  • Telnet: curl telnet://example.com
  • POP3: curl pop3://mail.example.com
  • IMAP: curl imap://mail.example.com
  • LDAP: curl ldap://example.com

예를 들어, curl ftp://ftp.example.com 명령어는 ftp.example.com FTP 서버에서 파일을 가져올 수 있습니다. 

curl telnet://example.com 명령어는 example.com Telnet 서버와 연결할 수 있습니다. 

Telnet은 보안에 취약하므로 SSH를 사용하는 것이 좋습니다.

728x90
반응형
LIST