Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add guide: download files with curl (#213)
- Loading branch information
1 parent
47b91bc
commit 33a513b
Showing
15 changed files
with
650 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
layout: guide-layout | ||
title: How to download files with curl | ||
excerpt: How to download files with curl | ||
permalink: /guides/curl-download-files | ||
permalink_without_prefix: /guides/curl-download-files | ||
lang: en | ||
--- | ||
|
||
**Table of contents** | ||
|
||
* TOC | ||
{:toc} | ||
|
||
## Introduction | ||
|
||
This guide is intended to teach you the basic ways to download files using [curl](https://github.com/curl/curl). As you follow these instructions, keep in mind that your computer's files and folders likely will be different from the samples. If you already have a lot of experience with the terminal, check out [the commands on the homepage for quick reference material](/). | ||
|
||
## Prerequisites | ||
|
||
In order follow this guide, you will need: | ||
|
||
* Access to a Unix terminal on any Linux or a macOS environment. | ||
* To know how to open a terminal window. If you are not sure, visit the instructions for [macOS](open-terminal-macos) or Linux (coming soon). | ||
* A file you want to download. We are using `https://terminalcheatsheet.com/sample-file.jpg` as an example in this guide. | ||
* The curl utility installed on your computer. Most macOS and Linux computers have it preinstalled. If not, you'll need to review the technical instructions [on the curl installation website](https://curl.haxx.se/docs/install.html){:target="_blank" rel="noopener"}. | ||
|
||
## Downloading a file | ||
|
||
Start by opening your terminal. | ||
|
||
`curl` is a "command-line tool for transferring data specified with URL syntax". This means it can download files from URLs. | ||
|
||
For example, [https://terminalcheatsheet.com/sample-file.jpg](https://terminalcheatsheet.com/sample-file.jpg){:target="_blank" rel="noopener"} returns an image file that we can download with curl. | ||
|
||
### Save with the filename from the URL | ||
|
||
If we want to download the file and save it with the same name, we can use this command: | ||
|
||
``` | ||
curl --remote-name [URL] | ||
``` | ||
|
||
`[URL]` is the URL we want to download the file from. `--remote-name` instructs curl to use the name from the URL as the name for the file on the computer. | ||
|
||
We can use this shorter command to do the same: | ||
|
||
``` | ||
curl -O [URL] | ||
``` | ||
|
||
`-O` is a short way of writing `--remote-name` from the previous command. | ||
|
||
### Save with a different filename | ||
|
||
If we want to download the file and save it with a different name, we can use this command instead: | ||
|
||
``` | ||
curl --output [FILENAME] [URL] | ||
``` | ||
|
||
* `[URL]` - We tell `curl` the URL to download. | ||
* `--output [FILENAME]` - We tell `curl` where to save the file. | ||
|
||
We can use this shorter command to do the same: | ||
|
||
``` | ||
curl -o [FILENAME] [URL] | ||
``` | ||
|
||
* `[URL]` - We tell `curl` the URL to download. | ||
* `-o [FILENAME]` - We tell `curl` where to save the file. | ||
|
||
## Wrapping up | ||
|
||
Now you know a bit about using `curl` to download files from a URL. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
layout: guide-layout | ||
title: كيفية تنزيل الملفات باستخدام الـ curl | ||
excerpt: كيفية تنزيل الملفات باستخدام الـ curl | ||
permalink: /ar/guides/curl-download-files | ||
permalink_without_prefix: /guides/curl-download-files | ||
lang: ar | ||
direction: rtl | ||
--- | ||
|
||
**جدول المحتويات** | ||
|
||
* TOC | ||
{:toc} | ||
|
||
## مقدمة | ||
|
||
يهدف هذا الدليل إلى تعليمك الطرق الأساسية لتنزيل الملفات باستخدام [curl](https://github.com/curl/curl). أثناء اتباع هذه التعليمات، ضع في اعتبارك أن ملفات ومجلدات الكمبيوتر الخاصة بك على الأرجح ستكون مختلفة عن النماذج. إذا كنت تمتلك الكثير من الخبرة بالفعل مع المحطة، تحقق من [الأوامر الموجودة على الصفحة الرئيسية للحصول على مواد مرجعية سريعة](/ar/). | ||
|
||
## المتطلبات الأولية | ||
|
||
لاتباع هذا الدليل، ستحتاج إلى: | ||
|
||
* الوصول إلى نافذة المحطة على أي نظام تشغيل لينكس أو macOS. | ||
* معرفة كيفية فتح نافذة المحطة. إذا لم تكن متأكدًا، قم بزيارة التعليمات لـ [macOS](open-terminal-macos) أو Linux (قريبًا). | ||
* ملف تريد تنزيله. نستخدم `https://terminalcheatsheet.com/sample-file.jpg` كمثال في هذا الدليل. | ||
* تثبيت أداة curl على جهاز الكمبيوتر الخاص بك. يأتي معظم أجهزة الكمبيوتر بنظام macOS و Linux مزودة بها مسبقًا. إذا لم يكن الأمر كذلك، فستحتاج إلى مراجعة التعليمات الفنية [على موقع تثبيت curl](https://curl.haxx.se/docs/install.html){:target="_blank" rel="noopener"}. | ||
|
||
## تنزيل ملف | ||
|
||
ابدأ بفتح المحطة. | ||
|
||
تعتبر `curl` "أداة سطر الأوامر لنقل البيانات المحددة بصيغة عنوان URL". وهذا يعني أنه يمكن تنزيل الملفات من عناوين URL. | ||
|
||
على سبيل المثال، [https://terminalcheatsheet.com/sample-file.jpg](https://terminalcheatsheet.com/sample-file.jpg){:target="_blank" rel="noopener"} يعود بملف صورة يمكننا تنزيله باستخدام curl. | ||
|
||
### حفظ بنفس اسم الملف من الرابط | ||
|
||
إذا كنا نريد تنزيل الملف وحفظه بنفس الاسم، يمكننا استخدام هذا الأمر: | ||
|
||
``` | ||
curl --remote-name [URL] | ||
``` | ||
|
||
|
||
`[URL]` هو الرابط الذي نريد تنزيل الملف منه. يأمر `--remote-name` بأن يستخدم اسم الملف من الرابط كاسم للملف على الكمبيوتر. | ||
|
||
يمكننا استخدام هذا الأمر الأقصر للقيام بنفس الشيء: | ||
|
||
``` | ||
curl -O [URL] | ||
``` | ||
|
||
|
||
`-O` هو الطريقة المختصرة لكتابة `--remote-name` من الأمر السابق. | ||
|
||
### حفظ باسم ملف مختلف | ||
|
||
إذا كنا نريد تنزيل الملف وحفظه باسم مختلف، يمكننا استخدام هذا الأمر بدلاً من ذلك: | ||
|
||
``` | ||
curl --output [FILENAME] [URL] | ||
``` | ||
|
||
|
||
* `[URL]` - نخبر `curl` بالرابط الذي نريد تنزيله. | ||
* `--output [FILENAME]` - نخبر `curl` بمكان حفظ الملف. | ||
|
||
يمكننا استخدام هذا الأمر الأقصر للقيام بنفس الشيء: | ||
|
||
``` | ||
curl -o [FILENAME] [URL] | ||
``` | ||
|
||
* `[URL]` - نخبر `curl` بالرابط الذي نريد تنزيله. | ||
* `-o [FILENAME]` - نخبر `curl` بمكان حفظ الملف. | ||
|
||
## الختام | ||
|
||
الآن أنت تعرف قليلاً عن استخدام `curl` لتنزيل الملفات من رابط URL. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
layout: guide-layout | ||
title: Cómo descargar archivos con curl | ||
excerpt: Cómo descargar archivos con curl | ||
permalink: /es/guides/curl-download-files | ||
permalink_without_prefix: /guides/curl-download-files | ||
lang: es | ||
--- | ||
|
||
**Índice del artículo** | ||
|
||
* TOC | ||
{:toc} | ||
|
||
## Introducción | ||
Esta guía tiene como objetivo enseñarte las formas básicas de descargar archivos utilizando [curl](https://github.com/curl/curl). Mientras sigues estas instrucciones, ten en cuenta que los archivos y carpetas de tu computadora probablemente serán diferentes a los ejemplos. Si ya tienes mucha experiencia con el terminal, consulta [los comandos en la página de inicio para obtener material de referencia rápida](/es/). | ||
|
||
## Prerrequisitos | ||
|
||
Para seguir esta guía, necesitarás: | ||
|
||
* Acceso a un terminal en cualquier entorno Linux o macOS. | ||
* Saber abrir una ventana de terminal. Si no estás seguro, consulta las instrucciones para [macOS](open-terminal-macos) o Linux (próximamente). | ||
* Un archivo que quieras descargar. Estamos utilizando `https://terminalcheatsheet.com/sample-file.jpg` como ejemplo en esta guía. | ||
* La utilidad curl instalada en tu computadora. La mayoría de las computadoras macOS y Linux la tienen preinstalada. Si no es así, deberás revisar las instrucciones técnicas [en el sitio web de instalación de curl](https://curl.haxx.se/docs/install.html){:target="_blank" rel="noopener"}. | ||
|
||
## Descargando un archivo | ||
|
||
Comienza abriendo tu terminal. | ||
|
||
`curl` es una "herramienta de línea de comandos para transferir datos especificados con la sintaxis URL". Esto significa que puede descargar archivos desde URLs. | ||
|
||
Por ejemplo, [https://terminalcheatsheet.com/sample-file.jpg](https://terminalcheatsheet.com/sample-file.jpg){:target="_blank" rel="noopener"} devuelve un archivo de imagen que podemos descargar con curl. | ||
|
||
### Guardar con el nombre de archivo de la URL | ||
|
||
Si queremos descargar el archivo y guardarlo con el mismo nombre, podemos usar este comando: | ||
|
||
``` | ||
curl --remote-name [URL] | ||
``` | ||
|
||
`[URL]` es la URL desde la que queremos descargar el archivo. `--remote-name` indica a curl que use el nombre de la URL como el nombre del archivo en la computadora. | ||
|
||
Podemos usar este comando más corto para hacer lo mismo: | ||
|
||
``` | ||
curl -O [URL] | ||
``` | ||
|
||
`-O` es una forma abreviada de escribir `--remote-name` del comando anterior. | ||
|
||
### Guardar con un nombre de archivo diferente | ||
|
||
Si queremos descargar el archivo y guardarlo con un nombre diferente, podemos usar este comando en su lugar: | ||
|
||
``` | ||
curl --output [FILENAME] [URL] | ||
``` | ||
|
||
* `[URL]` - Le indicamos a `curl` la URL para descargar. | ||
* `--output [FILENAME]` - Le indicamos a `curl` dónde guardar el archivo. | ||
|
||
Podemos usar este comando más corto para hacer lo mismo: | ||
|
||
``` | ||
curl -o [FILENAME] [URL] | ||
``` | ||
|
||
* `[URL]` - Le indicamos a `curl` la URL para descargar. | ||
* `-o [FILENAME]` - Le indicamos a `curl` dónde guardar el archivo. | ||
|
||
## Conclusión | ||
|
||
Ahora ya sabes un poco sobre cómo usar `curl` para descargar archivos desde una URL. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.