Download a file from github using Linux commands
wget command is a commonly used CLI to download files from the internet.
curl is another command used to transfer data to or from a server.
Say, you’ve a LAMP setup in your Linux machine and want to download a php file form Github. Below is a simple php file that displays the details of an AWS EC2 instance.
If you use this command to download the file, and then open it in a browser. It will just be a github HTML page and not the actual php file.
This is because github typically serves up files with an html wrapper around them. This includes the context and operations you can perform on the file.
Commands like wget and curl just download whatever the server sends them.
In order to get the actual file, you can get a raw file from github instead.
Copy the URL of the raw file and then use the
curl command to download the file.
This will download the raw php file and not the HTML wrapped one.