Ubuntu – How to unzip a file in terminal and spit it out with specific file name

command linefilesunzip

I know I run sudo unzip file.zip -d /path/to/dir, but is there anyway to specify the output file name?

Best Answer

  • If you are certain that your zip-archive contains only one file you can extract it to a different filename with

    unzip -p > thenewFile

    Explanation: -p tells unzip to extract the content directly to stdout which then gets redirected into a new file.

  • Related Question