How to Extract a Tgz File in Windows from the Command Line

Download ArticleDownload Article

Tar files (a.k.a, ".tar.gz," ".tgz", or ".gz" files) are compressed archive files similar to ".zip" files. They are most commonly used on Unix-based operating systems like Linux, and macOS.[1] Since they are often used as regular data archival and storage, Windows users may come across them from time to time and need to extract them. While you can extract them using a third-party app like 7-Zip, it is much more efficient to extract them using the Windows Command Prompt. This How.com.vn article teaches you how to extract a tar file using the Windows Command Prompt.

  1. How.com.vn English: Step 1 Click the Windows Start Menu icon.
    It's the icon with the Windows logo. By default, it is in the lower-left corner in Windows 10.[2]
  2. How.com.vn English: Step 2 Type CMD.
    This displays the Command Prompt in the Windows Start menu.[3]
    Advertisement
  3. How.com.vn English: Step 3 Right-click the Command Prompt icon and click Run as Administrator.
    The Windows Command Prompt has an icon that resembles a black screen with a white text cursor. Right-click the Command Prompt to display a context menu. Click Run as Administrator at the top to launch the Command Prompt with administrative privileges.[4]
    • You must be logged in to an administrative account in order to launch an app as an administrator.
  4. How.com.vn English: Step 4 Type tar -xvzf.
    This is the beginning of the command to extract a ".tar" file. Do not press "Enter" just yet.
  5. How.com.vn English: Step 5 Press Space and enter the path to the tar file.
    Add a space after the "tar -xvzf" command and then enter the path to the location of the ".tgz" file. For example, if it is in your "Downloads" folder, you would enter "C:\Users\username\Downloads\".
    • You can find the path to a file by navigating to the file in File Explorer. Right-click the address bar at the top and click Copy Address. You can then paste it into the Command Prompt.
  6. How.com.vn English: Step 6 Enter the filename.
    Immediately after the path, enter the file name. For example, "archive.tgz."[5]
  7. How.com.vn English: Step 7 Press Space and then type -C.
    After entering the filename, add a space followed by "-C".
  8. How.com.vn English: Step 8 Add a space and enter the path to where you want to extract the file to.
    Immediately after "-C", add another space and then enter the path you want to extract the file to. For example, if you want to extract the contents of the folder to your "Documents" folder, you would enter "C:\Users\username\Documents.".
    • The entire command should look something like tar -xvzf C:\user\username\Downloads\archive.tgz -C C:\user\username\Documents
  9. How.com.vn English: Step 9 Press ↵ Enter.
    This extracts the contents of the tar file to the folder you specified.
  10. Advertisement

Expert Q&A

Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!

      About This Article

      How.com.vn English: Travis Boylls
      Written by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Travis Boylls. Travis Boylls is a Technology Writer and Editor for How.com.vn. Travis has experience writing technology-related articles, providing software customer service, and in graphic design. He specializes in Windows, macOS, Android, iOS, and Linux platforms. He studied graphic design at Pikes Peak Community College. This article has been viewed 53,054 times.
      How helpful is this?
      Co-authors: 5
      Updated: March 22, 2024
      Views: 53,054
      Categories: Windows Files
      Thanks to all authors for creating a page that has been read 53,054 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement