LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-05-2010, 09:15 AM   #1
ASTRAPI
Member
 
Registered: Feb 2007
Posts: 210

Rep: Reputation: 16
Question Compress .gz my folder with all contens inside, subfolders,images....


Hello

How can i compress to .gz my folder public_html:

media/sda7/user1/public_html/


I want all files and folders and subfolders and images and everything inside of public_html.

Also to be saved on the same folder so i can find it easy

How can i do it?

Thank you
 
Old 10-05-2010, 09:33 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
You can only gzip one file at a time. So tar, then gzip.

In other words, create an archive, then compress it. 'tar' can do this in one command for you.

Code:
tar cvzf media/sda7/user1/public_html/html.tar.gz media/sda7/user1/public_html/
 
Old 10-05-2010, 09:36 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4853Reputation: 4853Reputation: 4853Reputation: 4853Reputation: 4853Reputation: 4853Reputation: 4853Reputation: 4853Reputation: 4853Reputation: 4853Reputation: 4853
You can do it this way:
Code:
cd /media/sda7/user1
tar -cvzf backup.tar.gz public_html/
You can find your file backup.tar.gz in the folder /media/sda7/user1. Be sure to have enough space there.
For more info try
Code:
man tar
 
Old 10-05-2010, 09:45 AM   #4
ASTRAPI
Member
 
Registered: Feb 2007
Posts: 210

Original Poster
Rep: Reputation: 16
do i have to move to a folder or something when i login to ssh before i run this command?
 
Old 10-05-2010, 09:06 PM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,564

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
No you shouldn't have to but of course you need to have write permissions to wherever you are.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nautilus, set view for folder + subfolders kellemes Linux - Newbie 4 02-11-2010 12:20 PM
Samba folder containing subfolders with specific rights StarQuake64 Linux - Server 4 06-05-2009 01:05 PM
Determine if folder has subfolders with out overhead from find or ls davstin2002 Programming 8 12-21-2006 03:26 PM
Determine if folder has subfolders with out overhead from find or ls davstin2002 Programming 1 12-20-2006 06:49 PM
How to make JHEAD work on all subfolders within a folder SupaDucta Linux - Newbie 0 11-26-2004 07:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration