How to create an archive using tar in Linux
Guide Overview
This guide explains how to create an archive of files using the Linux/Unix tar command.
Requirements
Shell Access or Console
Instructions
- Connect to a shell or open a terminal/console on your Linux/Unix machine.
- To create an archive of a directory and its contents you would type the following and press enter:
- tar -cvf name.tar /path/to/directory
Substitute the name.tar with the name of the tar file you would like to create and substitute the directory name for the full path to the directory you would like to archive.
- tar -cvf name.tar /path/to/directory
- To create an archive of certfain files you would type the following and press enter:
- tar -cvf name.tar /path/to/file1 /path/to/file2 /path/to/file3
Substitute the name.tar with the name of the tar file you would like to create and substitute the the various files for the full path to the files you would like to archive. Each file you would like included in the archive should be seperated by a space.
- tar -cvf name.tar /path/to/file1 /path/to/file2 /path/to/file3



Back to top







