From 440af92f7bb73c148f8f571fdb58c5f347d58fb1 Mon Sep 17 00:00:00 2001 From: maggicl Date: Wed, 14 Nov 2018 17:56:45 +0000 Subject: [PATCH] interm: Added pages on watch and curl git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@183 a672b425-5310-4d7a-af5c-997e18724b81 --- site/pages/cmd/interm/curl.html | 83 ++++++++++++++++++++++++++++++++ site/pages/cmd/interm/watch.html | 40 +++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 site/pages/cmd/interm/curl.html create mode 100644 site/pages/cmd/interm/watch.html diff --git a/site/pages/cmd/interm/curl.html b/site/pages/cmd/interm/curl.html new file mode 100644 index 0000000..456f5b4 --- /dev/null +++ b/site/pages/cmd/interm/curl.html @@ -0,0 +1,83 @@ +--- +layout: page +category-page: intermediate +category-title: Intermediate commands +tags: curl download http client crawler request online +author: Claudio Maggioni +title: curl +--- +

+ The curl command is a fast and versatile shell program that can + request online content using various protocols, including HTTP, + FTP and POP3. Some example use cases for this utility are + the need to automate some remote call to a server, testing REST or + SOAP apis or simply download or display the HTML code of a + website. +

+ +

+ The name, as mentioned in the + Evertything curl online book, stands for "client URL" + and the right pronunciation rhymes with "earl" or "girl". By this fact, the + reader is able to tell the author of this page to stop pronuncing it as + "cooorl", like if the name is some sort of word in the + Bergamasque + dialect. +

+ +

Usage

+ +

+ curl is a very complex command: if you want to learn it deeply, + please refer to the previously mentioned guide called + Evertything curl. Some basic + ways to use this command are shown below: +

+ +

Download the contents of the page "example.com" to "file.html"

+ +
+curl example.com -o file.html
+
+ +

Download the contents of the page "en.wikipedia.org/wiki/Curl" to +a file with the same name as the last element in the path (here "Curl")

+ +
+curl -O en.wikipedia.org/wiki/Curl
+
+ +

Download the contents of the page "example.com" to "file.html"

+ +
+curl example.com -o file.html
+
+ +

Download the contents of the page "example.com" following location +redirects (-L flag)

+ +
+curl -O -L example.com 
+
+ +

Download the contents of the page "example.com" resuming a previous attempt +(-C flag)

+ +
+curl -O -C example.com 
+
+ + +

Do an HTTP DELETE request to "example.com" with a custom header +(-H and -X flags)

+ +
+curl -H 'User-Agent: Tamagotchi' -X DELETE example.com
+
+ +

Print to stdout "example.com" making a request with HTTP basic +authentication (-u flag)

+ +
+curl -u bob:P@ssw0rd example.com
+
diff --git a/site/pages/cmd/interm/watch.html b/site/pages/cmd/interm/watch.html new file mode 100644 index 0000000..505ea73 --- /dev/null +++ b/site/pages/cmd/interm/watch.html @@ -0,0 +1,40 @@ +--- +layout: page +category-page: intermediate +category-title: Intermediate commands +tags: watch repeat track analyse seconds +author: Claudio Maggioni +title: watch +--- +

+ The watch command is a system utility able to execute a command + every n seconds by clearing the screen and displaying the + output of the command each time the interval is over. This command is very + simple to use and very effective: it can be used to check the size in bytes + of a file while downloading it, or it can be used on Linux to jiggle + around the mouse every ~5 minutes with the command xdotool in + order to keep the computer awake. +

+ +

Usage

+ +

+ watch has a very simple syntax: the amount in seconds to wait + between executions is specified in seconds using the -n flag + and the default value is 2. Also, differences between older and + newer outputs are highlighted if the -d flag is used. +

+ +

Watch the size of "ubuntu.iso" every 5 seconds

+ +
+watch -n 5 du -h ubuntu.iso 
+
+ +

Watch the contents of "site.html" every 2 seconds and highlight the + differencies between iterations

+ +
+watch -d cat site.html
+
+