Michael Holst | ||
https://ccom.ucsd.edu/~mholst/ |
Distinguished Professor of Mathematics and Physics UC San Diego |
|
|
Downloading Binary Files with Web Browsers
Some of the files accessible by links in my pages (and elsewhere on the web) are compressed files, and must be downloaded as binary files. If a file has a ".gz" or ".Z" extension, or a variation such as ".tgz" or ".taz", then it is a compressed (possibly tar) file, and must be treated as an unreadable (by humans, that is) binary file. For example, the file "file.ps.gz" is a compressed postscript file. The reason we compress things like postscript files before putting links to them is that it saves you an enormous amount of time if you download the compressed version and uncompress it yourself on your local machine, versus than downloading the uncompressed version. If you don't want to pay attention to the extension on a filename to decide when a file is compressed or in binary form, you can simply click on the link and hope your web browser is smart enough to know when it should deal with a file in binary mode. If your web browser starts to show you garbage on the screen, then it is not handling the binary file correctly, and you need to do something special to tell the browser that the file is a binary file. For Netscape/Mozilla/Firefox, you simply hold down the SHIFT key as you click the left mouse button; the web browser will then know you want to download the link into a (possibly binary) file, and will ask you what filename it should use for creating the file. Other browsers work in a similar way. Once you have successfully downloaded the compressed file (call it for example file.ps.gz), you need to uncompress it using GNU gzip. The following command will do this on a UNIX machine with GNU tools, or a WinNT machine with GNU-Win32 installed: gzip -dv file.ps.gz This should create the postscipt file "file.ps". If you download a file named something like "file.tar.gz" or "file.tgz", then you have actually downloaded possibly an entire collection of directories and files, wrapped together into a single file called a "tar" file. In addition, the file has apparently been compressed, otherwise the name would just be "file.tar". This "gzipped tar file" can be uncompressed (producing simply a tar file named "file.tar") as follows: gzip -dv file.tgz The resulting file ("file.tar") is a UNIX "tar" file, and must be further processed with "tar" to unpack the files and directories that it contains. The following command (on a UNIX machine with GNU tools, or a WinNT machine with GNU-Win32 installed) would unpack this tar file into a collection of files and/or directories: tar xvf file.tar You can also do the uncompressing and untarring in one step as follows: gzip -dc file.tgz | tar xvf - (Don't forget the "-" at the end of the command.) If you have any trouble downloading any files, let me know. |