#13 The Ultimate Guide to wget and curl on Linux - Everything You Need to Know - [English]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone so this is gonna be a special video this is the 50 number video of this channel okay and in today's video we are going to learn how we can download anything from internet okay in this video the agenda for this video is we are going to learn two commands that is wget command and call command Okay however the differences will be taught on this particular video as well okay wget command is explicitly used for downloading stuffs from internet however girl command have various functionality it can be used for interacting with API right offers that particular thing all right let's get started with that stuff all right and I hope that the terminal is visible to you let me do a little bit of Zoom so let me switch as a super user so I'll type sudo to do so and I'll press LS to see the content which are already present okay now what I'll do I'll just create a new directory so nkdir downloads I'll visit into downloads okay list the content there is nothing okay let me clear the screen now what I'll do I I want to download any software let's say python for now so I'll just type uh I'll go over the a search browser and let's search for download python okay so this is the webpage that we are referring to now in order to download anything from internet we make use of wget and how to use that you just have to right click and copy the link just go over here and type wget okay and the link you copied when you paste it and press enter you can see the software has been downloaded and when you press LS the exe file you can see over here is present all right coming forward with the next thing that is called Command right okay so uh like you might be wondering what will happen if I copy this URL and do the same double get command over here it will do nothing but download the entire index file okay the index.html file which we get by doing inspect element when I press LS you will see there is an index.html file present okay and where it is coming from it is coming from here okay the same thing can be done with curl command the only difference would be the curl command will display entire lines which has been uh there in the index.html okay how you can see that you just have to type call and paste the same link when you press enter this is the entire stuff that we have in the index.html file okay moving forward let me stop this thing by pressing Ctrl C okay let me clear it and let me do LS to see the stuffs okay currently I have python.exe and the index.html file okay I mentioned in the beginning of the video that girl is used for interacting web interaction okay so if you want to do a web interaction with the terminal let's say you want to do a post call a get call a put call okay these are the some sort of calls that these are the methods okay API methods whenever we want to do something we want to post something let's say you want to login that particular stuff can be done with call okay in order to demonstrate that thing we are going to make use of a beautiful website in order to study API we make use of requests okay so it is known as the request.in okay this is a website which here usually we use for learning apis okay so here we get fake APS for now what I'll do I'll just take this particular API when I press over here so I'll just copy this thing and I Ctrl C I'll go over the console and we'll type the command okay and what would that be it would be curl space hyphen capital X space the link that you copied and when you press enter it is saying that no URL specified specified let me debug it what is the thing that we are currently missing all right let me check it once again okay so curl hyphen X we didn't mention the method okay so whenever here you are clicking over somewhere you are just giving a call a get call okay you are you want a particular request that is the get request right so I forgot to mention the get request okay so you just have to type curl hyphen X and the method it would be get and now paste the link when you press enter the entire stuff which is present over here is been listed over here all right so this is how you can make use of get command okay over curl how to do a post method what is post post is something that you are providing values all right that can be done so for that I'll just use a post ABI from here so let me choose a good one um okay let me take this one okay APS slash users let me copy this and how to do a postcode let me clear the screen once again clear the screen okay in order to do a post method you just have to type girl space now you have to uh Define the uh header and the format that you want to do right so here we are making use of Json JavaScript object notation okay all right so what to do in that particular case just type hyphen X the name of the method that you want to do here it would be post space now you have to define the format in which you are trying to display the things it is Json value right JavaScript object notification object notation right so that would be the header for us so I'll just write hyphen H for header all right and then I'll Define the content type that I want to display over there so here I'll write content hyphen type colon application application slash Json okay this will Define that we are representing the data the values which we are passing will be displayed in Json format all right next thing would be to pass the value the data and what would that be so as you can see on the API we are passing two values that is name and job okay the same thing will be done here as well so in order to pass the value we'll just make use of a single quote and here we are going to uh include it under the braces okay and then I'll pass the value in a key value form okay so this is the key this is the value so name and that would be Barry okay and it would be separated by a comma then again a key followed by a value okay uh what is the next entity that we are passing it is the job okay all right so I'll pass job over here and what would that be forensic forensic scientist okay these are the values that we are passing okay let me recall it once again curl hypher next the post method then the header type and the content that we want to display it is in Json format the data that we are passing that is name and the job okay and the next thing would be the next thing would be the link right obviously okay so what I'll do I'll just go here copy the link once again go over here and paste the link now when I press enter you can see the entire stuff has been written over there what are the values which we passed we just passed Barry and the job forensic scientist which is displayed over here but we are getting ID created at the timestamp that we are getting which means the post method successfully worked for us okay that is how we can make use of curl command what we can use for what what is the use case of wget to download stocks for internet all right curl command is used for doing API interaction as well as to read the pages okay it will bring the entire Pages page to us all right I hope this video was fruitful for for us okay and here we conclude the Linux crash course okay see you in another one and have a great day thank you for joining with us and see you in the next one thank you and have a great day bye foreign
Info
Channel: Shubham gour
Views: 313
Rating: undefined out of 5
Keywords: shubham, gour, theshubhamgour, devops, cloud, wget, curl, Linux commands, Linux tutorials, Linux productivity, Linux mastery, Linux power tools, Linux tips and tricks, Linux skills, Linux education, Linux beginners, Linux experts, Linux file downloads, command-line tools, command-line utilities, productivity hacks
Id: pmItd2h7s60
Channel Id: undefined
Length: 8min 18sec (498 seconds)
Published: Sun Apr 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.