Not in gzip format ошибка linux

In this article, we will discuss the solution for the error gzip: stdin: not in gzip format and what is the reason behind this error.

What Could Be the Reason for the error?

This error generally occurs when the user has created a simple tar file using the options(-cvpf), where

  • c: create a new archive
  • v: verbose
  • p: extract information about file permissions (default superuser)
  • f: use archive file

but at the time of extraction, a user tries to extract the file as a gzip file type using the options (-xzpf), where

  • x: extract the file from the archive
  • z: zgip file type
  • p: extract information about file permissions (default superuser)
  • f: use archive file

Difference between Tar, Zip, and Gz

Basis Tar Zip Gz
Definition Tar is a utility which was designed to combine the multiple files into single file. Zip is a utility that came in MS-DOS which is used for file compression.  Gz is a file extension that is used with gzip archive file.
Space efficiency It takes highest number of memory space. It takes sometime highest or moderate number of memory space. It takes least number of memory space.
Operating System supported Unix and Linux operating system Unix, Linux, Windows, Macintosh, Minix, Atari, Amiga, VMS, MS-DOS etc. Unix and Linux operating system.

Solution for the gzip: stdin: not in gzip format error

1. To solve the error, first, we need to check the file type.

file demo.tar.gz

2. As it is clearly shown this is not a gzip archive file but it is a POSIX archive file.

3. So, we got the almost solution to the problem. hence we need to extract the POSIX archive file using (-xvpf) options.

tar -xvpf demo.tar.gz

Conclusion

On the above article, it describes about an error when users uses different tar command options for creation and extraction. So, for solving this query first we need to look after the file type of the archive file. The ‘file’ command in Linux comes in handy and then we can use multiple of tar command options to solve this problem.

Last Updated :
30 Jan, 2023

Like Article

Save Article

This means the file isn’t really a gzipped tar file — or any kind of gzipped file — in spite of being named like one.

When you download a file with wget, check for indications like Length: unspecified [text/html] which shows it is plain text (text) and that it is intended to be interpreted as html. Check the wget output below —

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz"

--2017-10-12 12:39:40--  http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 23.72.136.27, 23.72.136.67
Connecting to download.oracle.com (download.oracle.com)|23.72.136.27|:80... connected.
HTTP request sent, awaiting response... 302 Not Allowed
Location: http://XXXX/FAQs/URLFiltering/ProxyWarning.html [following]
--2017-10-12 12:39:40--  http://XXXX/FAQs/URLFiltering/ProxyWarning.html
Resolving XXXX (XXXXX)... XXX.XX.XX.XXX
Connecting to XXXX (XXXX)|XXX.XX.XX.XXX|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17121 (17K) [text/html]
Saving to: ‘jdk-8u144-linux-x64.tar.gz’

100%[=========================================================================================================================================================================>] 17,121      --.-K/s   in 0.05s

2017-10-12 12:39:40 (349 KB/s) - ‘jdk-8u144-linux-x64.tar.gz’ saved [17121/17121]

This sort of confirms that you haven’t received a gzip file.

For a correct file, the wget output will show something like Length: 185515842 (177M) [application/x-gzip] as shown in the below output —

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz"

--2017-10-12 12:50:06--  http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... XX.XXX.XX.XX, XX.XX.XXX.XX
Connecting to download.oracle.com (download.oracle.com)|XX.XX.XXX.XX|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz [following]
--2017-10-12 12:50:06--  https://edelivery.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... XXX.XX.XXX.XX, 2600:1404:16:188::2d3e, 2600:1404:16:180::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|XXX.XX.XX.XXX|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1507827127_f44251ebbb44c6e61e7f202677f94afd [following]
--2017-10-12 12:50:07--  http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1507827127_f44251ebbb44c6e61
Connecting to download.oracle.com (download.oracle.com)|XX.XX.XXX.XX|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 185515842 (177M) [application/x-gzip]
Saving to: ‘jdk-8u144-linux-x64.tar.gz’

100%[=========================================================================================================================================================================>] 185,515,842 6.60MB/s   in 28s

2017-10-12 12:50:34 (6.43 MB/s) - ‘jdk-8u144-linux-x64.tar.gz’ saved [185515842/185515842]

The above shows a correct gzip application file has been downloaded.

You can also file, head, less, view utilities to check the file. For example, an HTML file would give the below output —

head jdk-8u144-linux-x64.tar.gz

Output:

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="/css/print.css" rel="stylesheet" media="print">
    <link href="/css/main.css" rel="stylesheet" media="screen">
    <link href="/css/font-awesome.min.css" rel="stylesheet">

The above shows it is indeed an HTML page which we are trying to unzip/untar — something that won’t work. If it was indeed a correct zip file (binary in nature) the output of head would have produced garbage — something like below —

head jdk-8u144-linux-x64.tar.gz

Output:

x�rY�[ms�F������ڍtіl���DR���Ŋ��j
                                       $�$,`0�h�_����/��=�@Q�w+��ձ*�Hbfz�{�~�{�i�x��k����޾}����z���w����g�����{�޼�;{s����w���⹳�7�N����i�
�����}
�¿g��������ק���7��s�����폺î߹�����~i��j�/�����޿#���=��=>��߿{}��|�������������3���X���]9�ޠ����u�����%ğ�<^)�H�8�F�R�t�o�L�u��S%�ds5�2_EZn�t^��
                                                                                                                                                 �N3��(��<��|'�q���R�N�gq�Uv!�ۻ�p���rL��M��u��.�Q�5�T��BNw�!$��<>�7G'$�,Mt4WY�Gi"�=��p�)�VIN3����ek��0��G
                                            �<L�c�ē�t-���2���G:Ϣia��I�<ʋg3���d�H����[2`�<I�A�6�W��<��C�������h��A0QL�2�4�-*
�x���Е�t%t1��f�>+A͂�,Lr�
                        �Fe:MBH��ɩ�
C�Q�r�S��<M�b�<,5���@���s��݉c��sp�f�=g��?��k���4�}��kh)�¹Z��#d�*{���-�.N�)�e��s:�H(VQ��3*�$2󞖔��rϨv�"o�_��!A�������B�l=A�|��@��0��1��5��4g�
�
���Se����H[2�����t��5�Df����$1���b$� h�Op����!Lvb!p��b�8^�Y���n�
                                                                          O��Ԫ߱��|��lW�lu��*�N�M���
�/�^0~�~�#��q��������K��;�d���aw4����ݎ'�~�7��ky�o���������t�'k��f����!vo���'o���     �.�Pn�
               �+��K"FA{����n2����v��!/Ok��r4�c5�x$'�.�&w�!�%�ޠo������2���i
                                                                               �a0��Ag�d����GH)G7~�g���b��%�b��rt�m~�    �����t0��    <������������5�q�t��K(��+Z<��=���:1��x�p=t�`��G@F��    i�����p8�����H.���dMLE��e[�`�'n��*h[��;�0w'��6A�١M�x�fpeB>&���MO�������`�@á/�"�����(��^���n��=����5��@�Mx��d:YAn���]|�w>��S��FA9�J�k!�@�

Try downloading from the official site and check if their download links have changed. Also check your proxy settings and make sure you have the right proxies enabled to download/wget it from the correct source.

На чтение 2 мин Просмотров 490 Опубликовано 29.01.2022

При работе с заархивированными файлами в Linux мы можем столкнуться с ошибкой » gzip:stdin: не в формате gzip «. Эта ошибка возникает из-за того, что файл был только заархивирован, а не сжат. Это означает, что файл не сжимается с помощью утилиты gzip, а переименовывается. Прежде чем узнать, как решить эту проблему, сначала мы попробуем разобраться в файлах gzip. Gzip — это сокращение от GNU zip, которое используется для сжатия и распаковки файлов.

В этой статье рассказывается, как решить » gzip: stdin: не в формате gzip » в Linux, и мы также объясним основную причину этой ошибки.

Как исправить gzip: stdin: не в формате gzip в Linux

У нас в системе есть файл с именем «myfile.tar.gz», мы попробуем извлечь файл с помощью команды:

Будет выдана ошибка, что означает, что файл не в формате gzip. Чтобы узнать формат файла, мы будем использовать команду файла:

Файл myfile.tar.gz находится в формате tar-архива POSIX (GNU) вместо формата gzip. Это означает, что файл был только заархивирован, а не сжат с помощью gzip. Имя файла было изменено путем добавления расширения «.gz». Теперь, когда мы знаем, что этот файл только заархивирован, а не сжат, мы можем извлечь файл, удалив флаг «z», поскольку этот флаг используется только для файлов, сжатых gzip.

У нас есть еще один файл с именем «myzipfile.tar.gz», который сжат с помощью утилиты gzip. Попробуем извлечь файл с помощью команды:

tar xvzf myzipfile.tar.gz

Файл не вызвал ошибки, потому что файл сжат с помощью утилиты gzip вместо добавления расширения.

Вывод

Ошибка «gzip: stdin: не в формате gzip» возникает, когда файл не в формате gzip. Есть два случая; либо файл только заархивирован и переименован с расширением «.gz», либо файл имеет какой-то другой формат. Gzip используется для архивирования, сжатия или распаковки файлов. В этой статье мы обсудили ошибку «gzip: stdin: not in gzip format» и объяснили на примерах, почему эта ошибка возникает и как ее можно решить.

Diagnosing a Downloaded File of the Wrong Type

As steeldriver says, this means the file isn’t really a gzipped tar file — or any kind of gzipped file — in spite of being named like one.

When you download a file with wget, there are often indications that you’ve ended up getting a different kind of file than what you were looking for:

ek@Io:~$ wget http://openwall.com/john/f/john-1.7.0.2.tar.gz
--2017-01-28 23:57:33--  http://openwall.com/john/f/john-1.7.0.2.tar.gz
Resolving openwall.com (openwall.com)... 195.42.179.197
Connecting to openwall.com (openwall.com)|195.42.179.197|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.openwall.com/john/ [following]
--2017-01-28 23:57:40--  http://www.openwall.com/john/
Resolving www.openwall.com (www.openwall.com)... 195.42.179.202
Connecting to www.openwall.com (www.openwall.com)|195.42.179.202|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘john-1.7.0.2.tar.gz’

john-1.7.0.2.tar.gz                          [      <=>                                                                        ]  15.27K  3.61KB/s    in 4.2s

2017-01-28 23:57:51 (3.61 KB/s) - ‘john-1.7.0.2.tar.gz’ saved [15633]

In this case, the main signs are:

  • The 301 Moved Permanently message, redirecting to an address with a trailing /. This loads the default page for some directory on the server, which is usually index.html and almost always an HTML file.
  • Length: unspecified [text/html], telling you that you’re receiving plain text (text) and that it is intended to be interpreted as html. This is really more than a sign — you can be pretty sure you haven’t gotten a real gzipped file based on this.

You can also use the file utility, which examines a file and tells you what kind of file it looks to be:

ek@Io:~$ file john-1.7.0.2.tar.gz
john-1.7.0.2.tar.gz: HTML document, ASCII text, with very long lines

And of course you can examine the file yourself, with tools such as head, less, and view:

ek@Io:~$ head john-1.7.0.2.tar.gz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>John the Ripper password cracker</TITLE>
<link href="/style.css" type="text/css" rel="stylesheet">
<META name="keywords" content="John the Ripper, password cracker, JtR, password checker, password recovery, password, cracker, crackers, cracking, crack, crypt, passwd, shadow, Unix, Linux, Windows, Win32, Mac OS X, Mac OSX, MacOS X, OS X, OSX, DOS, VMS, OpenVMS, hash, DES, MD5, Blowfish, Kerberos, AFS, LM, LanMan, LanManager, NT, 2000, XP, 2003, Vista, 7, NTLM, NTLMv1, MD4, Netscape LDAP, SHA, SSHA, MySQL, TGT, s/key, Eggdrop, Apache, apr1, SYSUAF, SYSUAF.DAT, AltiVec, MMX, SSE, SSE2, AVX, XOP, wordlist, wordlists, dictionary, brute force, decrypt, challenge, response, John, Ripper, john, jhon, jonh, jack, Jack the Ripper">
<META name="description" content="A fast password cracker for Unix, Windows, DOS, and OpenVMS, with support for Unix, Windows, and Kerberos AFS passwords, plus a lot more with contributed patches">
</HEAD>

<BODY bgcolor="#E0E0E0" text="black" link="blue" alink="red" vlink="navy">

If this were really a binary file, then you would’ve gotten a whole bunch of meaningless garbage instead, as whatever pager or viewer your use fruitlessly attempts to interpret something as plain text that really isn’t. For example, on the correct file:

ek@Io:~$ head john-1.8.0.tar.gz
WӦQ♥john-1.8.0.tar ▒▒kw▒ر&▒▒ٿ▒▒▒▒4E]|▒v▒NF▒d[▒n▒▒▒L&▒HB▒$▒ ▒df͚▒▒▒▒▒ꩪ▒7@▒▒▒9ӳf▒▒J▒m     ▒ؗ▒u▒▒~,▒ї▒▒▒ˣ▒▒ӣ_▒▒▒▒C▒▒|▒▒▒▒▒şw▒v▒▒>▒|w▒▒▒}▒▒▒ί▒▒i9▒?7+▒gY7i▒$▒▒ʲ▒▒s?▒J'MV%▒rY4ur[▒4▒▒e▒▒.▒▒▒▒▒&/u▒-2▒W▒▒V▒▒!o▒0b▒▒▒♥▒|Q▒4▒▒▒&▒▒Y1Y▒F▒▒Iy▒▒▒▒$▒▒▒▒,▒]▒h▒▒8▒"▒▒M▒,Һ~(▒i▒4Y▒d▒QgQ▒*ۚf7yA▒.▒&i▒<d▒↓▒7▒H_-l▒7▒▒▒Z▒▒.m▒▒ʒ%F,▒۬▒*▒▒hrW▒cY▒▒
▒+▒O1▒-y>▒▒J▒yM?▒4I▒▒▒kYS▒▒:▒▒n▒C▒▒%▒▒▒v▒▒▒{[[tN▒9▒▒▒kA▒▒▒▒▒/[▒▒▒▒u▒▒▒z▒▒▒▒>▒▒5▒▒▒▒t▒t▒▒Y6Û<▒*/i▒i{K>▒,▒▒▒▒▒;9)▒Z.mJSeiLB▒▒▒▒▒j▒▒eQ緅▒_▒α▒Ŋ▒▒▒W▒▒▒▒▒_▒▒ˢ▒▒-q▒<gyw͍▒9▒?▒,▒▒▒▒h&▒V"▒▒▒▒▒▒▒l▒▒3▒▒▒▒▒▒i#▒▒综▒◄0▒▒▒.e♠>a▒▒▒▒▒▒$klt:▒▒rA▒M▒'F▒R▒▒▒▒Lo▒♥1z▒▒↓X▒▒▒P"֕▒▒▒♦▒▒▒▒|▒▒▒▒▒▒1I▒o"'#|6e▒▒t▒Ц▒FVL▒▒S▒ޓ▒▒;▒x▒▒▒▒▒▒▒QVrr▒▒▒9O▒W7▒♠Og▒
▒▒▒8▒▒/▒▒dm▒FG'▒'t2L▒▒&L▒Y:▒▒▒▒▒4▒rI<▒#▒+▒je▒▒▒>T9▒▒M▒XE-ʆ▒▒'n▒▒$↑▒m▒W▒▒w̕▒▒m▒n%▒|A_▒yGp↑D▒↓߻▒▒▒i▒▒}ӡH▒▒▒▒׍$$H▒▒&▒▒4▒▒▒Z-@♣▒*~▒▒▒ y6▒▒▒`▒v↓▒s▒+̱▒?▒1▒▒▒<▒>▒^▒▒Y#k▒
7`N'▒o▒.&▒▒(▒Դ~AD▒"E◄' lq▒`▒▒`▒[▒9◄▒▒wzuK▒N▒▒Y▒▒%or▒▒)▒▒i↓▒▒▒l5.S▒޶r▒_*▒RO▒{▒$▒(▒▒▒▒C▒·▒▒׀f2ˊ[:▒▒▒,|ew▒▒▒Ag▒'▒▒▒H▒▒t▒{͓▒▒▒▒JH˭s▒)g▒ON▒▒eŚQ▒▒▒♠ s▒▒ߪ▒▒▒▒▒▒▒▒▒▒_♠▒-▒

(I’ve only copied the very beginning of that.)

Getting the Right File

That tells you how to figure out what went wrong in these situations (and in this case, in particular). But how do you actually find and download the correct file?

This varies from situation to situation. However, a good start is to:

  • Go to the official website for the software and see if they provide download links. Even if that’s how you got the link you’re using originally, if some time has passed you may find that the link has changed.

    For example, in this particular case, the current version is 1.8.0 instead of 1.7.0.2 (and provided in the j subdirectory instead of f), and the old version is no longer available at that same URL.

  • Go to the page that you were redirected to when you downloaded the file. In this case, that’s: http://www.openwall.com/john/

    Or you can even examine the file that was downloaded. (Or open it in a web browser.)

You got redirected to the software’s main download page. You can either download in a web browser, or copy a correct current download link and download it with wget. There are a few choices, but assuming you don’t actually need that specific old version you were trying to download, and based on the specific file you did attempt to download, I suspect http://openwall.com/john/j/john-1.8.0.tar.gz is what you are looking for.

Of course, readers who find this post later may find that link no longer works. But the approach demonstrated here for troubleshooting this sort of problem will remain valid.

ek@Io:~$ wget http://openwall.com/john/j/john-1.8.0.tar.gz
--2017-01-29 00:16:19--  http://openwall.com/john/j/john-1.8.0.tar.gz
Resolving openwall.com (openwall.com)... 195.42.179.197
Connecting to openwall.com (openwall.com)|195.42.179.197|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5450412 (5.2M) [application/x-tar]
Saving to: ‘john-1.8.0.tar.gz’

john-1.8.0.tar.gz                        100%[================================================================================>]   5.20M  78.8KB/s    in 26s

2017-01-29 00:16:47 (202 KB/s) - ‘john-1.8.0.tar.gz’ saved [5450412/5450412]

I’ve downloaded the file. Notice that, this time, no undesired redirection happened and the type is given as application/x-tar instead of text/html.

(An HTTP redirection is not always bad. It’s when you get redirected to something that doesn’t seem like it could really be the file you’re looking for that you should suspect your download has not really succeeded.)

file agrees:

ek@Io:~$ file john-1.8.0.tar.gz
john-1.8.0.tar.gz: gzip compressed data, was "john-1.8.0.tar", last modified: Thu May 30 04:19:35 2013, max compression, from Unix

And it unpacks successfully:

ek@Io:~$ tar xf john-1.8.0.tar.gz
ek@Io:~$ cd john-1.8.0/
ek@Io:~/john-1.8.0$ ls -l
total 12
drwxrwxr-x 2 ek ek 4096 Jan 29 00:22 doc
lrwxrwxrwx 1 ek ek   10 May 29  2013 README -> doc/README
drwxrwxr-x 2 ek ek 4096 Jan 29 00:22 run
drwxrwxr-x 2 ek ek 4096 Jan 29 00:22 src

(You are right that it doesn’t matter if you use the z; it would still have worked with tar xzf, since this is the correct file.)

You can proceed to build the source code and install.

Remember, You Don’t Always Have to Build From Source

Sometimes you really want the latest version of a program, and it’s not in Ubuntu’s repositories. You might try to find a PPA, but if you don’t find any you really trust or that provide quite what you want, or you want to build it with custom options, or you just really like building from source code, then building from source code is a valuable and useful technique.

I do recommend checking at least the software that is available in Ubuntu’s official repositories for your system, though. On my 16.04 system:

ek@Io:~$ apt show john
Package: john
Version: 1.8.0-2
Priority: optional
Section: admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Ruben Molina <rmolina@udea.edu.co>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 452 kB
Depends: libc6 (>= 2.14), john-data (= 1.8.0-2)
Suggests: wordlist
Homepage: http://www.openwall.com/john/
Supported: 5y
Download-Size: 184 kB
APT-Sources: http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Description: active password cracking tool
 John the Ripper is a tool designed to help systems administrators to
 find weak (easy to guess or crack through brute force) passwords, and
 even automatically mail users warning them about it, if it is desired.
 .
 Besides several crypt(3) password hash types most commonly found on
 various Unix flavors, supported out of the box are Kerberos AFS and
 Windows NT/2000/XP/2003 LM hashes, plus several more with contributed
 patches.

There are several other ways to search for packages. Often it’s handy to use the Ubuntu Packages Search web page.

Since you were going to attempt to install version 1.7.0.2, presumably version 1.8.0 in the official repositories is recent enough. (Indeed, 1.8.0 seems to be the same version as the one provided for download from the official website.) So you really might just want to install that:

sudo apt update
sudo apt install john

Hey folks! In this article, we will discuss how to solve gzip: stdin: not in gzip format error while extracting a zipped file using the tar command.

Let’s say you’re trying to extract an archive named archive.tar.gz using the tar command.

It throws the following error:

Extracting File Shows Error
Extracting File Shows Error

What Could Be the Reason?

First, check the type of the file using the file command, run :

Check File type Of The Archive
Check File type Of The Archive

The output says that the given file is a POSIX tar archive, which means the file was not zipped in a tar.gz format, it was only compressed using the tar command and was later renamed for some reason.

The problem arises when you try to extract the compressed file, using a zip (-z) option of the tar command.

Difference between Tar, Zip and Gz

There are a few differences between a tar, a zip, and a gz archive format. Files ending with .tar extension are uncompressed archive files, whereas files ending with .zip extensions are usually compressed zipped files. And a .gz file can or cannot be an archive, but it is a compressed file as well.

Solution for the gzip: stdin: not in gzip format error

 We just have to not use -z attribute in our tar command to begin the extraction of the archive. Type the following commands in your terminal and run :

Now, your file will be extracted correctly, as this time we do not encounter any error on our screen.

No Error During Extraction Using xf Option
No Error During Extraction Using xf Option

Conclusion

Because naming conventions do not matter in Linux, one can get easily confused if someone decides to rename a video file in .txt format. It will still play, mind you, but it will be confusing to a lot of new users. Similarly, if someone renames a .tar file to .tar.gz extension, it will cause problems as well. Use file command followed by the name of the file to know the format of any file if you encounter any issue while executing it. We hope you solved your encountered problem with the help of this article.

Gzip file format allows you to compress one or more files & folders into a single file. However, while extracting/uncompressing this file, sometimes, you may get the error ‘stdin: not in gzip format’. Here is how to fix this problem.

Let us say you run the tar command on the gzip file sample.tar.gz

$ tar -xvzf sample.tar.gz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors

As you can see, the error message says that the file is not in gzip format. Please note, only a file that has been compressed to .gz file format will work properly in this case.

If you have renamed a .tar file as .tar.gz file, or .tar.bz2 to .tar.gz file, or .zip file to .gzip file, you will get this error.

Alternatively, you may get this error if you have used -z option on a .tar file. For example, if you have a .tar file and not a .tar.gz file, don’t use -z option. Just use -xvf

$ tar -xvf sample.tar

This is because they all have different algorithms for archival/compression.

So use the file command to identify the original file format of your .gz file.

$ file sample.tar.gz
sample.tar.gz: POSIX tar archive (GNU)

As you can see, the sample.tar.gz file is just a POSIX archive file. So you need to use only -xvf option, with tar command.

$ tar -xvf sample.tar.gz

If your file is in some other format, then you need to use the appropriate tool to extract it. For example, if it is a zip file then use unzip command.

$ unzip sample.tar.gz

Please note, you will need to install unzip command separately on your system with the following command. It is not present on most Linux systems.

$ sudo apt install unzip     [On Debian/Ubuntu] 
$ sudo yum install unzip    [On CentOS/RHEL]
$ sudo dnf install unzip     [On Fedora 22+]

If it is bz2 file, use bzip2 command to decompress it.

$ sudo bzip2 -d sample.tar.gz

Again, you will need to install bzip2 with the following command, since it is not present on most Linux systems.

$ sudo apt install bzip2     [On Debian/Ubuntu] 
$ sudo yum install  bzip2    [On CentOS/RHEL]
$ sudo dnf install bzip2     [On Fedora 22+]

In this short article, we have learnt how to fix ‘stdin: not in gzip format’ error in Linux. You can use these steps on any Linux system.

Also read:

How to Find & Kill Zombie Process in Linux
How to Disable Strict Host Key Checking in SSH
How to Create Superuser in Django
How to Print in Same Line in Python
How to Import from Another Folder in Python

Related posts:

Data conservation and transfer are extremely important aspects of computing. For this purpose, files are often archived or compressed based on the user’s needs. While dealing with such files, an error may pop up on your system with the statement “gzip: stdin: not in gzip format”.

This article will help to provide a detailed guide on the major reasoning behind this error and assist in fixing this issue.

How to Resolve the “gzip: stdin: not in gzip format” Problem?

To fully understand this error, it is important to gain some background knowledge of this reason. The “GNU” zip is a tool to compress any file or folder. Anything compressed using this tool gets the extension of “.gz” and the file is called a “gzip” file. Check out the sample below:

Reason: File is Not a “.gz” File

As demonstrated above, a file compressed using the gzip tool is renamed with a “.gz” extension. The error is prompted when the file with “.gz” in its name is not actually a gzip compressed file. This means that the file possibly got renamed to “.gz” manually. Check out the example shown below:

Notice, how the file in this snippet does not have the same icon as the “sample1” (shown above) compressed file that was shown above. That is because it is not a real gzip compressed file, and it has only been renamed to “.gz”.

This can also be confirmed using the command shown below:

$ file example.tar.gz

This command will display the type of file that is mentioned in the command. In this case, it clearly shows that the “example” file is not a compressed file. The “z” flag used in the command above is used for a gzip file. Since the “example” file, in this case, is not compressed and hence not a gzip file, the z option prompts the error.

Solution: Remove the “z” Option

Now that we have the complete background and information behind this error. Let’s check out how this issue can be resolved. The fix is extremely simple. Since the file is not compressed, the error can be fixed by simply removing the “z” option in the command, which only refers to gzip files. Following this, the correct command would be as follows:

$ tar -xvf example.tar.gz

The snippet above shows that removing the “z” option from the command enables the command to run successfully.

Conclusion

The “gzip: stdin: not in gzip format” problem is invoked when a file is incorrectly named to be “.gz” but it is not compressed. This causes problems with the “z” option in the command since this option is used only for real gzip compressed files. This error can easily be fixed by removing the “z” option from the “tar” command. This article provides detailed information on what causes this error and how to resolve it.

Понравилась статья? Поделить с друзьями:
  • Not enough available memory god of war ошибка
  • Not authorized код ошибки
  • Not aus ошибка
  • Not another pdf scanner 2 ошибка драйвера сканирования
  • Not allowed to load local resource ошибка