title: Getting kernel version from the compressed kernel image
body: <p>I am working on a shell script. I have a pre-built zImage. is it possible to know the kernel version from which this zImage was created?</p>
  
  <p>I have tried with the commands updated @ <a href="https://stackoverflow.com/questions/9535227/getting-uname-information-from-a-compressed-kernel-image">Getting uname information from a compressed kernel image</a>, but both commands are failing.</p>
  
  <pre class="lang-none prettyprint-override"><code>$ dd if=zImage bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' zImage | \
    cut -d ':' -f 1) | zcat | grep -a 'Linux version'
  
  dd: unrecognized operand `3165585'
  Try `dd --help' for more information.
  
  gzip: stdin: unexpected end of file
  
  $ dd if=zImage bs=1 skip=$(LC_ALL=C grep -a -b -o $'\xFD\x37\x7A\x58\x5A\x00' zImage | \
    head -n 1 | cut -d ':' -f 1) | xzcat | grep -a 'Linux version'
  
  xzcat: (stdin): File format not recognized
  </code></pre>
  
  <p>Can you guide me to identify the kernel version from zImage.</p>