9951 explained code solutions for 126 technologies

cli-tarHow do I extract a tar file using the terminal?

To extract a tar file using the terminal, you can use the tar command with the -x option. This command will extract the contents of the tar file into the current directory.


tar -xvf my_file.tar

Output example

x file1.txt
x file2.txt
x file3.txt

The command consists of the following parts:

  • tar: the command to extract tar files
  • -x: the option to extract the tar file
  • -v: the option to show the progress of the extraction
  • f: the option to specify the file to extract
  • my_file.tar: the name of the tar file to be extracted

For more information on the tar command, see the following links:

Edit this code on GitHub