In a previous article I described how to zip and backup your website files using the LINUX server ssh command line, this time I’ll explain how to unzip and restore website files using the LINUX command line. The process is really quite simple and is achieved in just 2 main steps.
- Locate the backup archive file.
- Extract the file to the target directory
1. Locate the Backup File
(replace “host.server.com” with the address of the server where the backup file is located)
(replace “~/archive” with the name of the folder containing the backup file)
2. Extract the file to the target directory
tar -zxvf archive_filename -C destination_parent_folder
(replace “archive_filename” with the name of the backup file)
(replace “destination_parent_folder” with the name of the directory which will contain the extracted directories and files)
And there you go. Go to the new destination folder and check that the files are there.
If the root folder name already exists in the destination parent folder, use the –strip 1 parameter to exclude the root directory while the archive unpacks. This avoids the site root name appearing twice.