Wget download a file and save as a different filename

by Daniel Pham
Published: Updated:

In this article, I will show you how to use wget download a file and save as a filename different?

Wget is a tool that supports downloading files in Linux, which is very light and useful.

Download files with wget

Using wget to download files is quite simple, its syntax is as follows.

$ wget [url]

For example, let’s try downloading a file with the link as follows.

$ wget https://gitlab.com/Danny_Pham/WriteBash.com/raw/master/Install/08-Script_install_rkhunter_on_CentOS_6.sh
use wget to download a file
Use wget to download a file.

And as you see the result in the image above, the downloaded file is named 08-Script_install_rkhunter_on_CentOS_6.sh.

Download a file and save as a different filename

Okey, now we will go to the main problem of the article.

Recommended Reading: How to install rkhunter on CentOS 6

There are times when you want to save the file as another name when you download it to your computer. How to do? Using wget with the -O option will solve this problem.

There are 2 ways to type wget with the -O option.

The first way.

$ wget -O [filename] [URL]

The second way.

$ wget [URL] -O [filename]

In some old Linux operating systems, maybe the second way will not work.

For example, with the above link, you can type the command below.

$ wget https://gitlab.com/Danny_Pham/WriteBash.com/raw/master/Install/08-Script_install_rkhunter_on_CentOS_6.sh -O script.sh
use wget download a file and save as a different filename
Use wget download a file and save as a different filename.


This article is just a small tip, it’s nothing complicated. But sometimes, it is useful for those who have never used wget or just started using Linux.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.