How to unzip a file in a specific folder in colaboratory environment after download it?

To extract the files from the tar archiver to the folder content/cell_images use the command-line option -C:

!tar -xvf  'test.tar' -C 'content/cell_images'

Hope this helps!


Although late answer, but might help others:

shutil.unpack_archive works with almost all archive formats (e.g., “zip”, “tar”, “gztar”, “bztar”, “xztar”) and it's simple:

import shutil
shutil.unpack_archive("filename", "path_to_extract")