Command to zip up content

whats the command to zip up my entire domain’s content
if i was in the folder /

tar -cz -f backup.tgz *

Maximum Cash Discount on any plan with MAXCASH

While this command is absolutely correct, I prefer to compress the containing folder when archiving my sites. There are two reasons for this technique. First, you don’t end up with the archive file mixed in with the files that it contains. Secondly, you don’t end up with really messy directories when you inevitably decompress an archive at the wrong location. In fact, I prefer to archive to a “backups” directory under my root, but that’s of no consequence for my example.

I would suggest using “tar -czf mydomain.com_YYYYMMDD.tgz” from the parent directory. (substituting the current date for YYYYMMDD of course)

Me too, but he stressed “if i was in the folder /”

I agree it’s better to be in $HOME and archive and entire domain within it’s own containing folder - if it’s a backup that you’re actually performing. There are occassions where the retention of the domain directory becomes a hinderance though; for example when you’re transporting data between accounts or hosts with pre-existing structures already in place, necessitating more convoluted commands on the receiving system.

Maximum Cash Discount on any plan with MAXCASH