Skip to main content

Posts

Showing posts from August, 2022

How to Untar files in Linux

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...

How to tar files in linux

What is  “tar” ? tar stands for tape archive. A group of files and directories can be combined using the tar command to create a highly compressed archive file known as a tarball or as tar, gzip, or bzip in Linux. How to tar ? In this example we will create a tar archive file webwithmi.tar for a directory /home/webwithmi in the current working directory.  Here webwithmi contains the following files and directories /home/webwithmi/example1.sh /home/webwithmi/example2.tar.gz /home/webwithmi/example3 /home/webwithmi/example4.txt Using the below  command we can create a tar archive file. # tar -cvf webwithmi.tar /home/webwithmi/ Here c - Creates a new .tar archive file. v - Show the .tar file progress f - File name type of archive file To Create  tar.gz file  To create a compressed gzip archive file we use the option as    z . Note :  tar.gz and tgz both are similar # tar cvzf webwithmi.tar.gz /home/webwithmi # tar cvzf webwithmi .tgz /home/webwi...