How to Download Files From the Internet using Linux



Linux


In this article, we show how to download files from the internet using linux.

Linux is a powerful operating system that can do very different dynamic tasks.

Using the Linux operating system, we can download files from the internet. This can be a PDF file, an HTML file, a PHP file, an image file, a video file, etc.

This means we can download files from the internet such as PDF files, video files, image files, as well as download web pages such as the home page of a certain website.

This means that with Linux, we do not need to actually open a browser, go to acertain website, and click on a link to download a file. We can do this just using the Linux command terminal without opening any browser. This is assuming you know the URL is.



How to Download a File From the Internet

So let's now go into how to download a file from the internet.

We do this using the wget command in linux.

After the wget command, you specify the full path to the file you want to download on the web.

The format to do this is shown below.



So let's do an example to download a real file on the internet. We will do it from this website.



So with this line above, we are able to download the 2N3904 datasheet from this website.

This is how it looks when downloaded from the linux command terminal.

Downloading a file from the internet with the linux operating system

You can see that the file successfully downloaded because it says it's 100% downloaded and it says saved.

Downloaded file in the linux file system

When we go into the linux file system, we see that the file saved in the home directory. This is because we used the wget command in the home directory. We can now acccess this file and open and use it.

So this is an example of downloading a file, in this case, a PDF file from the internet without opening or using any browser. Linux, through an internet connection, connects the server hosting the file on the internet that you want to download and downloads it.

Remember that the wget command can download any type of file, including images, videos, etc.

Below is an example of an image download in linux.



This downloads an image of a 555 timer chip to the home directory.

Below is an example of a video download in linux.



This downloads a video of connecting an arduino microphone circuit which can record audio.

So the wget command can really download any type of file.



How to Download a Web Page From the Internet

The wget command can also download entire web pages, such as a website's home page or any particular page on a website.

It works just like above, specifying the web page after the wget command.

To download the home of this web page, the code is shown below.



This will download the home page of this website.

To download any file on a website, just specify the full path to that page. The code below downloads a PHP file.



And this is how we can download entire web pages using the Linux operating system. This works for HTML files, Javascript files, PHP files, etc.

And this is how we can download a file from the internet using the linux operating system.


Related Resources

How to Get the Current Working Directory in Linux

How to Create a New File in Linux

How to Retrieve the Contents of a File in Linux

How to Delete a File in Linux

How to Delete a Directory in Linux

How to List Hidden Files in Linux

How to Rename a File or Directory in Linux

How to Determine the File Type of a File in Linux



HTML Comment Box is loading comments...