Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 04-16-2008, 01:40 PM   #1
Registered: Nov 2007
Posts: 75

Rep: Reputation: 15
zipping a directory

I am thinking of copying some directories of my current system over to a new system soon.

How do I tar a directory? What is the command. I do know how to unzip a tar file . I don't want to enable samba right now since it is in production.

Btw, its redhat ES4 if that matters.

Old 04-16-2008, 02:05 PM   #2
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
tar czf filename.tgz dir-or-files for gzip compression or tar cjf dir-or-files for bzip2 compression

you can then move it over via whatever method you prefer (ftp, scp, sftp, nfs, ...)

another option may be rsync (over ssh).
or you can get "complex" by using tar and pushing to the server and extracting "on-the-fly".
root@oldserver data]# tar czf - . | ssh newserver 'tar xzvf - -C /path/to/where/you/want/files/'
note that the use of '.' is to get everything in the current directory 'data' which has all files on oldserver you want to duplicate to the newserver.

Hope this helps.
Old 04-16-2008, 02:55 PM   #3
Registered: Nov 2007
Posts: 75

Original Poster
Rep: Reputation: 15
Thanks man. Do you know what czf option means?

Old 04-16-2008, 05:54 PM   #4
Registered: Oct 2005
Location: Florida, USA
Distribution: Ubuntu 8.04, 9.04
Posts: 37

Rep: Reputation: 15
c = create

z = compress

f = filename of compressed file


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
Recursively zipping directories AckSed Linux - Newbie 2 10-19-2007 08:29 PM
Zipping a folder Gins Linux - General 9 06-19-2007 06:17 PM
Compressing/Zipping A Directory Wha?Where? Linux - Newbie 4 07-07-2005 10:20 PM
Zipping of files rajesh_b Programming 5 10-27-2004 07:02 AM
Zipping and Taring and ? Goatdemon Linux - Newbie 3 05-22-2002 08:17 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:11 PM.

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