Related Posts. Tee Command in Linux with Examples October 26, Handling filenames with spaces in Linux September 15, Rahul on June 2, am. Use -o with curl command to save file in other directory.
Don't have a Linux machine? If you'd like the file to have a different file name perhaps readme is too bossy for you , specify it after -O : curl -o dontreadme. Use cURL to download multiple files That's all well and good, but downloading lots of files in this way would quickly become a hassle.
Get cURL to follow redirects As it's common for site admins to move the location of a file, then redirect to the new one, it can be good practice to include the -L option in your cURL command.
For example, if we try to access BitLaunch's robots. We can review this redirect chain with: curl -v www. If you want a custom user agent, then you can find one from WhatIsMyBrowser. Despite it being a simple and lightweight tool, curl offers tons of features. Compared to other command-line download managers, like wget, curl offers a more sophisticated way of handling file downloads. For in-depth information, I always recommend checking out the man page of curl, which you can open with the following command:.
Check out some of the best download managers for Linux here. Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint. Curl is a popular command-line tool used for downloading files from the Internet. It is a lightweight tool that is available on any UNIX system. If no protocol is specified, curl defaults to HTTP. You can simply use the following command to accomplish this:. Imagine you have specified a URL as part of the curl command and think you have the right address to download a large file only to come back later to find that all you have is a webpage stating 'this page has been redirected to www.
That would be annoying, wouldn't it? The curl command is clever in that it can follow redirects. All you have to do is use the minus L switch -L as follows:. If you are downloading a large file and you have a poor internet connection then you might annoy the family if they are trying to do stuff on the internet as well.
Keep in mind that reducing the download speed will increase the time it takes for a transfer to complete. The curl command can handle more than just HTTP file transfers. If you specify the name of a file as part of the URL then it will download the file but if you specify the name of a folder it will return a folder listing. You can use curl to fill in an online form and submit the data as if you had filled it in yourself.
Many popular services such as Google block this sort of usage. Imagine there is a form with a name and email address. You can submit this information as follows:. There are various ways of transferring form information. The above command uses basic text, but if you want to use multi encoding which allows image transfer then you will need to use the minus F switch -F.
0コメント