Rename A File Downloaded With ‘wget’

In today’s article, we’re going to learn how to rename a file downloaded with ‘wget’. This will not be a complicated article. It will also be a pretty short article. If you want to learn how to rename a file downloaded with ‘wget’, read on and you’ll see how!

Often, you’ll use ‘wget’ to download a file and it will have some sort of convoluted file name. You can download a file with ‘wget’ and rename it automatically. If this is something you’re interested in doing, we’ll learn how to do it in this article.

We’ve used ‘wget before. See:

How To: Hide The Output From wget
Make wget Use IPv4 or IPv6
How To: Make ‘wget’ Ignore Certificate Errors

We’ve used ‘wget’ in other articles, so feel free to use the search function to see the other articles about ‘wget’.

If you’re curious, you can check the man page. You’ll see ‘wget’ defines itself as:

Wget – The non-interactive network downloader.

That’s a good enough description, I suppose. Basically, you use ‘wget’ in the terminal to download files. It’s a pretty handy application and, importantly, a pretty universal application. If you’re using a GNU/Linux desktop (or server), you’ve almost certainly got ‘wget’ as an available tool.

So then…

Rename A File Downloaded With ‘wget’:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Let’s ensure you have ‘wget’ installed with:

If ‘wget’ is not installed, install it from your package manager. Once installed, you can take it on a test run:

Now, we’re going to make ‘wget’ keep trying in case the download has issues. We’ll use the -c (continue) flag:

You probably don’t need the -c flag for this file, but it’s a good habit to get into. If we add the -O flag (for output-document) to the command, it’d look like this:

Or, to try to make it more clear:

In the latter example, you’ll have downloaded the file and renamed it to numbers.txt instead of saving it as the original filename. See? Pretty simple!

Closure:

There you have it. You have a new article. This time, we’ve learned how to rename a file downloaded with wget. It’s a handy trick to keep in mind, as people tend to want to give their files names with things like version information and all that. If you want a simpler file name, this is a nice easy way to do it.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe to Newsletter!
Get notified when new articles are published!
We promise to never share your email!
icon

Author: KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.