TAR is command used to archive a directory to TAPE device on OpenBSD, like on any other UNIX OSes.
To achive a directory named, say, /home/test/www, to a file named wwwbackup.tar, do the following:
#cd /home/test/www
#tar cfv wwwbackup.tar .
note the f switch, it tell tar to send all files to a file instead of the tape device, which is the default destination if f switch is not present. At the end, it tells you how much blocks it archived.
Also note the “.”, which represents current directory.
To view or list the archived file, use:
# tar tf wwwbackup.tar
To create a compressed tar file, use “z” switch:
#tar czf wwwbackup.tar.gz .
To view a gzip compressed tar file, use:
# tar tfz wwwbackup.tar.gz
To restore from a tar file, use:
#tar xf wwwbackup.tar
Or, if compressed,
#tar xzf wwwbackup.tar.gz
To archive only a certain directories, just specify the the name you want to archive:
#tar cfz partialwww.tar.gz dir1 dir2 dir5
To append to a existing archive, use r switch instead c; To update an archive, use “u” switch instead of “c”.
#man tar for more information.
THE END