Verified Jobs Live
Unix / Linux Beginner Level ~1 min read

How to tar and Untar files in unix

Quick Revision Summary

To Tar Files of a directory and sub directories recursively: tar cvzf foo.tgz freshershome Will tar the directory freshershome (and its files/subdirectories) into a tar file nam...

Interactive Practice Mode
Formulate your thoughts or take notes before revealing the model solution.
Model Answer & Deep-Dive Explanation

To Tar Files of a directory and sub directories recursively:

tar cvzf foo.tgz freshershome

Will tar the directory freshershome (and its files/subdirectories) into a tar file named foo.tgz.

To extract gzip-1.2.4.tar and compile the sources on Unix systems, do: tar xvf freshershome.tar Or tar -xzvf freshershome.tar.gz Above will extract freshershome.tar.gz: Will work on .tar.gz (or .tgz). Take out the 'z' for a plain .tar. Replace it with a 'j' for .tar.bz. Run 'man tar' for more complete instructions on using tar.

Interviewer Evaluation Points & Scoring Rubric

  • 1 Structure answer clearly: Core concept, Practical example, and Pitfalls to avoid.
  • 2 Demonstrate clear communication without unnecessary buzzwords.
  • 3 Relate concept to real-world software development scenarios.