Score:0

Compress directory for backup

be flag

Id like to compress var/www/all sites for backup. What would the command line be to compress them and all sub folders. thanks

Score:2
in flag

You can do this with tar and a few convenient options:

tar -zcvf backup.tar.gz /var/www

The -zcvf option list breaks down like this:

  • -z: Gzip the archive
  • -c: create archive
  • -v: verbose mode (show you what’s happening)
  • -f: set the file name

If you choose to automate this, you can include the current date in the file name like this:

tar -zcvf backup-$(date '+%Y-%m-%d').tar.gz /var/www
be flag
Thank You , much appreciated
be flag
where would this save to, i expected it to be var ?
in flag
If you are running this manually, it will be saved to the current directory. If you want it saved to a specific location, you can specify it with a full file location after the `-zcvf` bit
be flag
good man, thanks
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.