Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I download a file from the internet to my linux server with Bash [closed]

Tags:

linux

centos

I recently had to upgrade to a VPS server (HostGator Linux) because I wanted to run a script that was a bit more complicated than the regular PHP db manipulation. I'm trying to install a JDK and Apache Ant (if it matters, for compiling Android Apps on server).

I watched tutorials on Linux Bash and started using it. I am currently trying to install Java (with JDK and JRE) on to the server.

I am following the tutorial on this page: http://www.oracle.com/technetwork/java/javase/install-linux-64-self-extracting-142068.html

However, I don't know what to do at this line:

  1. Download and check the download file size.

    You can download to any directory that you can write to.

How do I download Java from the command line?

If it matters, I am running CentOS v5.8

like image 801
user1893185 Avatar asked Jan 13 '13 04:01

user1893185


People also ask

How do I transfer a file to a Linux server?

Using SCP (SSH) With the SCP command, you can transfer files from your computer to your Linux server and vice versa. As this utility uses SSH to move files, you'll need the SSH credential of your server to transfer files.

How do I download something over SSH?

Scp Command The "scp" command is a secure version of the Unix copy command "cp." Once you establish an SSH session with the remote machine, locate the file you wish to copy. The "scp" command is a better option if you have only a few files to transfer. The "-p" flag preserved the file modification and access times.


2 Answers

Using wget

wget -O /tmp/myfile 'http://www.google.com/logo.jpg' 

or curl:

curl -o /tmp/myfile 'http://www.google.com/logo.jpg' 
like image 197
imxylz Avatar answered Sep 21 '22 07:09

imxylz


You can use the command wget to download from command line. Specifically, you could use

wget http://download.oracle.com/otn-pub/java/jdk/7u10-b18/jdk-7u10-linux-x64.tar.gz 

However because Oracle requires you to accept a license agreement this may not work (and I am currently unable to test it).

like image 33
Alex DiCarlo Avatar answered Sep 21 '22 07:09

Alex DiCarlo