Page 1 of 1

How to unzip and zip file from the Terminal?

Posted: Sat Jul 22, 2017 9:21 am
by arnlweb
How to Unzip?

# unzip file.zip -d destination_folder
# unzip filename.zip -d /home/admin/web/example.com/public_html/

How to Zip?

# zip -r filename.zip directory -x .*
# zip -r filename.zip /home/admin/web/example.com/public_html/ -x .*

Re: How to unzip and zip file from the Terminal?

Posted: Fri Jul 28, 2017 11:41 am
by arnlweb
sudo apt-get install zip

creating a zip file:

zip -r compressed_filename.zip foldername

exclude hidden files:

find /folder_path -path '*/.*' -prune -o -type f -print | zip ~/compressed_filename.zip [email protected]

Re: How to unzip and zip file from the Terminal?

Posted: Fri Jul 28, 2017 11:42 am
by arnlweb
zip -r zipfile.zip directory -x directory/.*

Re: How to unzip and zip file from the Terminal?

Posted: Fri Jul 28, 2017 11:45 am
by arnlweb
TAR Example for excluding all folders beginning with:

tar cvpzf filename.tgz folder/ --exclude '.*'

Better compress (slower):

tar cvpjf filename.tar.bz2 folder/ --exclude '.*'