Welcome on my blog

We use cookies to ensure you get the best experience on our website.

Linux – Curl – Przydatne komendy

Autor: chmajster 12.09.2022

Curl – jest to program używany w liniach poleceń lub skryptach do przesyłania danych

Pobierz plik z URL

curl -O http://=========.com/example.jpg

pi@chris:~ $ curl -O http://=========.com/example.jpg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  190k  100  190k    0     0  1082k      0 --:--:-- --:--:-- --:--:-- 1082k

Pobierz plik z URL z nową nazwą

curl http://=========.com/example.jpg --output some.file

Pobierz plik z debug włączonym

curl -vvvvv  -O http://=========.com/example.jpg

pi@chris:~ $ curl -vvvvv  -O http://=========/example.jpg
* Expire in 0 ms for 6 (transfer 0x1fc2950)
* Expire in 1 ms for 1 (transfer 0x1fc2950)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Expire in 1 ms for 1 (transfer 0x1fc2950)
* Expire in 2 ms for 1 (transfer 0x1fc2950)
*   Trying 0.0.0.0....
* TCP_NODELAY set
* Expire in 149995 ms for 3 (transfer 0x1fc2950)
* Expire in 200 ms for 4 (transfer 0x1fc2950)
* Connected to ========= (=========) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): 

Pobierz plik z URL – bez output

curl http://=========.com/example.jpg --output my.file --silent

Pobierz plik z URL z maksymalną prędkością 200K

curl --limit-rate 200K -O https://=========.com/example.jpg

Pobierz plik z ftp or sftp

curl ftp://ftp-your-domain-name/file.tar.gz

Pobierz plik korzystając z proxy server

curl -x proxy-server-ip:PORT -O url

curl -x 192.168.44.1:8888 http://=========.com/

curl -U username:password -x 192.168.44.1:8888 http://=========.com/

curl -x 'http://YourUsernameHere:YourPasswordHere@10.12.249.194:3128' -v -O https://=====.com/631.pdf

Pobierz informacje o nagłówku zwracanym przez serwer

curl -I url
curl -I http://=========.com/sticker_book.pdf -o output.pdf

Pobieranie kodu odpowiedzi serwera

curl -s -o /dev/null -w "%{http_code}" url
curl -s -o /dev/null -w "%{http_code}" https://google.pl/

Pomiń sprawdzanie certyfikatu SSL

curl -k url
curl -k http://=========.com/

Ustaw agenta w zapytaniu

curl -A 'user agent name' url
curl -A 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0' http://=========.com/

Zezwól na przekierowanie

curl -L http://=========.com/

Wysyłanie plików z użyciem FTP

curl -T newfile.tar.gz -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/
Dodaj komentarz

Search
Categories
O Blogu

Cześć Podróżniku!

Ta strona ma nie być typowym poradnikiem w IT, Głównym jej cel to zapisanie krótkich notatek, które mogą się przydać w codziennym życiu podczas korzystania/konfiguracji różnych urządzeń np. Ustawienia DHCP na Routerze Cisco, Ustawieniu Karty sieciowej na Linuxie itp.

Buy me A coffee
[Empty]

Wszelkie prawa zastrzeżone