How to compress and extract files/folders using the tar command on Ubuntu

Ask a question+

I need to download a folder from my server, to do that I want to compress that folder on the server, download it to my PC and extract it. Can you please help me how I can do that?

add comment

1 Answer


To compress an entire directory or file you need to run.
tar -czvf archive_name.tar.gz /path/to/directory-or-file
To extract it run this.
tar -xzvf archive_name.tar.gz
For more details check here

add comment

Your Answer