untar Command in Linux

Learn via video courses
Topics Covered

Build an AI-First Career, Master the Complete Skillset

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program
NSDC Certified

AI Forward Deployed Engineer Program

Full-stack engineering, production AI and client-facing consulting

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program

Overview

In this article, we'll explore the untar command in Linux, which is primarily used to extract files from tar archives. The tar command is widely used for backup and archiving purposes, as it can package multiple files into a single tarball. The untar command can help you to decompress and extract the files from these tarballs.

Linux untar Command Syntax

The syntax for the untar command is as follows:

Where:

  • options: These are flags and options that determine the behavior of the tar command.
  • archive-name: The name of the tarball to be processed.

untar Command Options:

  • -x: Extract files from an archive.
  • -f: Specify the archive file.
  • -v: Verbose mode, display the progress on the screen.
  • -C: Change to the specified directory before performing the operation.
Sharpen Your Fundamentals with Free Learning

Example Usages

  • Basic untar command usage:

    Output:

    Explanation: The '-x' option is used to extract files, and '-f' is used to specify the archive file.

  • Untar with verbose mode:

    Output:

    Explanation: The '-v' option enables verbose mode.

How Scaler Transformed Careers in Different Fields

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Tips

  • Always use '-f' option to specify the archive file, as not using it may lead to unexpected behavior.

  • Use the '-C' option to extract files to a specific directory instead of the current directory.

Stop learning AI in fragments—master a structured AI Engineering Course with hands-on GenAI systems with IIT Roorkee CEC Certification

ScalerIIT Roorkee

AI Engineering Course Advanced Certification by IIT-Roorkee CEC

A hands on AI engineering program covering Machine Learning, Generative AI, and LLMs - designed for working professionals & delivered by IIT Roorkee in collaboration with Scaler.

Enrol Now
IIT Roorkee Campus

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Advanced Use Cases of untar Command in Linux

  • Untar a gzipped tarball:

    Output:

    Explanation: The '-z' option tells tar to decompress the gzipped archive before extracting.

  • Untar a bzipped tarball:

    Output:

    Explanation: The '-j' option tells tar to decompress the bzipped archive before extracting.

  • Untar to a specific directory:

    Output:

    Explanation: The '-C' option is used to change the directory before extraction.

Conclusion

  • The untar command is used to extract files from tar archives.

  • Various options like '-x', '-f', '-v', and '-C' can be combined to control the extraction process.

  • It's essential to use the '-f' option to specify the archive file.

  • Advanced options like '-z' and '-j' can be used to handle compressed tarballs.

  • The '-C' option allows extracting files to a specific directory.