Introduction
Users may want a specific file or folder extracted from a cPanel-generated backup. This article provides the steps to do this.
Procedure
Please note that in our examples, we will use the following information. You must replace our values with your backup file location, content to extract, and temporary directory.
- Backup file location:
/backup/2020-08-16/accounts/cptest.tar.gz
- Directory to extract:
public_html
-
Temporary directory:
/temp_location
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Use the
tar tfz
command with thegrep
command to locate the path to the file or folder to extract.[root@server ~]cPs# tar tfz /backup/2020-08-16/accounts/cptest.tar.gz | grep public_html | grep -v .cpanel | head -1
cptest/homedir/public_html/ - Create a directory in which to place the data.
mkdir /temp_location
- Change to the new directory.
cd /temp_location/
- Use the
tar xfvz
command to extract the directory from the backup file.tar xfvz /backup/2020-08-16/accounts/cptest.tar.gz cptest/homedir/public_html
Please note that "cptest/homedir/public_html" must be replaced with the path located with thetar tfz
command. - Use the
ls
command to verify that the desired content was extracted.ls -lah cptest/homedir/public_html/
Comments
0 comments
Article is closed for comments.