- Forums
- Linux Systems
- Compress Tar Files And Directory With Permissions Command
This Page Contains information about Compress Tar Files And Directory With Permissions Command By marvin in category Linux Systems with 3 Replies. [2871], Last Updated: Sat May 18, 2024
marvin
Tue Sep 12, 2006
3 Comments
9684 Visits
Sometimes I need to compress and make backups of files and directories. but when I uncompress the tar.gz file, the owner and group permissions change to root.
I found a way to keep (retain) the group and user permssions with this command:
example: suppose i want to make a backup copy of my
public_html directory which is located at
/var/www/html/ and want to compress it retaining the files group and user owership permissions. so to backup my
public_html (/var/www/html/public_html) i would move to the html directory:
change directory to where the to be tar file is located:
CODE:
cd var/www/html
now execute this command to do the compressing of
public_htmlCODE:
tar -pczf public_html.tar.gz public_html/