Skip to content

Instantly share code, notes, and snippets.

@uptimizt
Created October 24, 2018 08:15
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uptimizt/bfb6b0fa6bc6093fc59a4127e1c101ec to your computer and use it in GitHub Desktop.
Save uptimizt/bfb6b0fa6bc6093fc59a4127e1c101ec to your computer and use it in GitHub Desktop.
Extract Sql.Gz File On Command Line (macos, linux)
gzip -d backup-20100910164109.sql.gz
@salmagomaa
Copy link

thanks

@beto-aveiga
Copy link

Thanks!

@hoodasaad
Copy link

Thanks

@devbranch-bit
Copy link

Thanks!

@KevinChauvet
Copy link

thanks mate !

@juresaht2
Copy link

zcat backup-20100910164109.sql.gz | mysql -u root dbname
gzip -d changes the file.

@Username070
Copy link

The command that was provided by @juresaht2 is a bit more than what this gists is about..

Command zcat backup-20100910164109.sql.gz | mysql -u root dbname will extract the zip, but it will also pipe the output to mysql server, which is not expected by this "Extract Sql.Gz File On Command Line (macos, linux)" gists title.

@juresaht2
Copy link

And? This is how it's typically used.

People don't usually unpack archives to look at the SQL commands, you typically need it in a database.

@Username070
Copy link

I just wanted to note, that your given command could produce an unexpected result and ruin someones day..

@juresaht2
Copy link

Well if they were copying commands off the Internet without understanding them they deserved it.

https://explainshell.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment