I have a file named like file.bin.gz
.
I tried using gzip -d f.bin.gz
to uncompress it, and got a .bin
file.
Is the correct way to uncompress .bin
files to use gzip -d
? Also, .bin
is a binary file, right?
I have a file named like file.bin.gz
.
I tried using gzip -d f.bin.gz
to uncompress it, and got a .bin
file.
Is the correct way to uncompress .bin
files to use gzip -d
? Also, .bin
is a binary file, right?
Yes, what you did was one of the correct ways. To un-gzip a
.gz
file, usegunzip
orgzip -d
.If your gzipped file is
file.bin.gz
, you can decompress it with:This decompresses it to
file.bin
. If the operation succeeds, the originalfile.bin.gz
is automatically removed. This is to say that the gzipped file is replaced with the decompressed file.If you want to keep the original, pass the
-k
/--keep
flag:gzip
behaves likegunzip
when it is invoked with the-d
/--decompress
/--uncompress
flag. So this works too:As with
gunzip
, the default behavior ofgzip -d
is to replace its input file once it succeeds. You can pass both-d
and-k
if you want to keep the input file.(All of this applies regardless of what kind of file you want to decompress; none of it is specific to the file having
.bin
in its name--that's just part of the example I've used, to better match your situation.)You can run
man gunzip
for more information, orgunzip --help
for a summary of options.As for what the
.bin
in the filename is likely to mean, you have surmised correctly that a file named.bin
is usually a binary file. However, there are several different kinds of files that are sometimes named this way and, furthermore, the vast majority of binary files do not have.bin
in their names.To get more information about what
file.bin
is, runfile
on it:(This is not specific to
file.bin
havingfile
in its name. In general for a fileabc
you can learn about what kind of file it appears to be by runningfile abc
.)(This is also not specific to the
.bin
part of the filename having Any Meaning At All)If you really need to identify the type of file you can use the
file
program after decompressing:will consult a database looking for known markers of file types (like the string '' or 'GIF89a') and output what kind of file it thinks it is. As stated before, sometimes programmers will use .bin to disguise a standard file type by just changing the extension.