Download files from remote systems using the WGET command in Linux

Home > Search > Linux commands
  by

The wget command can be used to download files from remote systems to your local Linux system. To put this another way, wget can transfer a file from a remote system to your local Linux system. In this example, the wget command is used to download file1.txt from the www.example.com web server.

~]# wget http://www.example.com/file1.txt 

 

In this example, the wget command is used to download file2.txt from the example.com FTP server.

~]# wget ftp://example.com/file2.txt

 


Background

Some downloads can take a while. If a download is taking a while, you can switch to another TTY console so that you can continue to interact with the Terminal. Or, you can use the -b or --background option to run wget in the background.

~]# wget -b http://www.example.com/big.iso 

 


Quiet

Wget without any options can produce quite a bit of output. The -q or --quiet option can be used to not display any output when running the wget command.

~]# wget -q ftp://example.com/file3.txt 

 


Username Password

If the target system requires a username and password for the resource being requested, the --user and --password options can be used to provide the username and password.

~]# wget http://www.example.com/file1.txt --user=the_username --password=the_password

 

The --ask-password option can be used to prompt for the password when running the command.

~]# wget http://www.example.com/file1.txt --ask-password

 

Also, the /home/username/.wgetrc file can be created, and the username and password can be stored in the .wgetrc file. If the HTTP and FTP username and password is identical, use this format:

user=your_username
password=your_password

 

If the HTTP and FTP username and password are different, use this format:

ftp_user=your_username
ftp_password=your_password
http_user=your_username
http_password=your_password

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments