Using option x,
simply use the following command to untar or extract a tar file.
the below command will untar the file webwithmi.tar in the present working directory.
## Untar files in Current Directory ##
# tar -xvf webwithmi.tar
## Untar files in specified Directory ##
# tar -xvf webwithmi.tar -C /home/public/mi/
Untar a single file from a tar file
# tar -xvf webwithmi.sh.tar webwithmi.sh
OR
# tar --extract --file=webwithmi.sh.tar webwithmi.sh
Untar Single file from tar.gz
# tar -zxvf webwithmi.tar.gz webwithmi.xml
OR
# tar --extract --file=webwithmi.tar.gz webwithmi.xml
Untar Multiple files from tar, tar.gz, and tar.bz2
# tar -xvf webwithmi.tar "file1" "file2"
# tar -zxvf webwithmi.tar.gz "file1" "file2"
# tar -jxvf webwithmi.tar.bz2 "file1" "file2"
Extract Group of Files using Wildcard
To extract a group of all files whose pattern begins with .php from a tar, tar.gz, and tar.bz2 archive file.
# tar -xvf webwithmi.tar --wildcards '*.txt'
# tar -zxvf webwithmi.tar.gz --wildcards '*.txt'
# tar -jxvf webwithmi.tar.bz2 --wildcards '*.txt'
Comments
Post a Comment