SystemMen - 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
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
Conclusion
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.
«« Install Ansible AWX on CentOS 7Introduction to Docker technology »»