How to use the tar command

Last update on November 1, 2008 07:00 AM by jak58
Published by jak58

How to use the tar command




Archiving files with “tarâ€


The "tar" command allow you to regroup several files to store them in a single file, still remaining uncompressed.

Archiving folder (or directory) with “tarâ€


tar -vcf archive_name.tar name_of_file

tar: the command
vcf: the options
v :provides a description of archived content (optional)
c: to create an archive
f: to specify a name for the archive(in parameter)
archive_name.tar: name given to the archive (the argument)
name_of_file: name of the folder (or directory) to be archived

Unpacking file with tar


The tar command is also used to unpack the files, ie to extract all the individual files contained in an archive file.

Unpack the file with tar



tar-vxf my_file.tar

tar: the command
vxf: the options
v:provides a description of the unpacked files (optional)
x:to extract the files
f:to designate the archive containing the files (given parameter)
my_file.tar: the name of the archive to retrieve

Unpacking specific files with "tar"


Example:

You can also unpack only part of a “tar†archive and extract specific files.
tar -xvf my_archive.tar "*.jpg"

Extract in the file "my_archive" all files with the .jpg extension ".

For a list of all files in the archive, use the "-t".

tar -tf my_file.tar
Best answers for « How to use the tar command » in :
Command prompts for Windows Show Command prompts for Windows Some of these command below can cause harmful an undesirable functions, leading to the formatting of your hard disk and data loss, while others will not run under Windows XP. As for Windows Vista the Run Tab is not...
Command to detect your IP address! Show Command to detect your IP address! Command for Windows 2000 / XP / Vista Command for Windows 95/98 Command for Linux IP address (Internet Protocol) is a numerical identification to detect your computer on a network. It is used to...
Start/stop a service using command line ShowStart/stop a service using command line The netsh tool (netsh.exe) can automate the startup or shutdown of a service through the following command line: To start a service: Net start name_of_service To stop a service:...
[Windows XP] Repairing the network connection using command line Show[Windows XP] Repairing the network connection using command lines Under Windows XP there is a small feature allowing you to repair a network connection. Go to the Network Connections options in Control panel (Control Panel / Network...
List of open ports in command line ShowList of open ports in command line Whether you're running Windows or Linux / Unix, the following command in (console) will display the list of open ports on your computer: netstat -a For the use of advanced graphics tools, see What...
Network tests and diagnostics ShowTesting the IP configuration Before doing anything else, you are advised to check the computer's IP configuration. Windows systems offer a command-line tool, called ipconfig, that lets you find out your computer's IP configuration. The output of...
Windows - Diagnostic tools ShowAccessing diagnostic tools On the Desktop, when you right-click on a drive and go to Properties, the "Tools" tab gives you access to three tools: Defragmenter (c:\windows\defrag.exe) Scandisk (c:\windows\command\scandisk.exe) Backup (c:\program...
Cmd - cmd.exe Showcmd - cmd.exe cmd.exe (cmd signifiant Windows Command Prompt) is a Windows NT/2000/XP generic process which opens a text-mode console for running programs using a command line. The process cmd is not in any way a virus, a worm, a Trojan horse,...