You would frequently require to download files from the server, but sometimes a file can be very large in size and it may take a long time to download it from the server. Downloading large file from server using FTP is time consuming. You can download the file from the server, using command line, which can be done in a few minutes.
If the file is large or you want to download a full folder from the server then you can compress the file to formats like zip, tar, tar.gz etc. For this example we will Zip the file/folder. To download the file/folder, follow the below mentioned steps:
If you want to download a large file or a full folder then first zip your file or folder in order to compress it and then download it.
Step 1 : Login to the server using the SSH login details. You can use softwares are putty or Terminal to access your server from SSH.
Step 2 : Since we are using ‘Zip’ for this example, the server must have Zip installed. To Install zip (incase you do not have it), type the following command
sudo apt-get install zip
Step 3 : Compress the file or folder you want to download. In order to zip the file, type the following command
For file :
zip filename.zip original_file (do not forget to add file extension)
where “filename” is the name of the zip file which will be created and original_file is the name of the original file
For folder :
zip -r example.zip folder_name
where “example” is the name of zip file which will be created after the command and “folder_name” is the name of folder which you want to zip
Step 4 : Now download the file using the following command
wget http://Path.to.the.zip.file
This command will store the file in the same directory where you run wget. If you want to store the downloaded file somewhere else, you may use -P option. The command for it :
wget -P /path/to/directory http://link.to.file
If you have downloaded zipped file then follow the following steps in order to get the original files
Step 5 : Install unzip (if you do not have) on your local machine. In order to install the unzip, type the following command
Step 5 : Install unzip (if you do not have) on your local machine. In order to install the unzip, type the following command
sudo apt-get install unzip
Step 6 : Navigate to the directory where the file is downloaded via command line
cd /path/to/directory
Step 7 : Type the following command
unzip example.zip
where “example.zip” is the file name of zipped file.
0 comments