Extract zip or tar.gz Files in Jupyter Notebook: A Beginner Guide- Jupyter Notebook Tutorial

By | June 14, 2022

It is easy to extract zip or tar.gz files in jupyter notebook. In this tutorial, we will introduce you how to do.

First, we should know how to run a command in jupyter notebook, here is the tutorial:

Running Linux Command in Jupyter Notebook: A Step Guide – Jupyter Notebook Tutorial

Use unzip command to extract .zip files

We can run unzip command to extract a zip file. Here is an example:

!unzip rirs_noises.zip

Use tar command to extract .tar.gz files

For example:

!tar -zxvf filename.tgz

You should notice:

In some jupyter notebooks, we can run linux command without symbol ! as follows:

unzip rirs_noises.zip

However, if you get a syntax error, you should use !.

For example:

Extract zip or tar.gz Files in Jupyter Notebook - A Beginner Guide- Jupyter Notebook Tutorial

Moreover, if you have a .tgz file, you also can extract it in jupyter notebook.

For example:

!tar -zxvf filename.tgz -C /tmp/data

Step Guide to Unzip .tgz File in Linux – Linux Tutorial

Leave a Reply