乐闻世界logo
搜索文章和话题

How to specify the download location with wget?

1个答案

1

When using wget, specify the download location by using the -P or --directory-prefix parameter, followed by the desired save path.

For example, if you want to download a file to the /home/username/downloads directory, you can use the following command:

bash
wget -P /home/username/downloads http://example.com/somefile.zip

This command instructs wget to download the file from http://example.com/somefile.zip and save it in the /home/username/downloads directory.

Alternatively, you can use the full parameter name:

bash
wget --directory-prefix=/home/username/downloads http://example.com/somefile.zip

This command serves the same purpose as the previous one but uses the full parameter name to specify the download directory, enhancing command readability.

These approaches are highly practical, especially when you need to organize downloaded files directly into specific directories.

2024年7月30日 00:17 回复

你的答案