LINUX How to create an archive using tar

  • 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.
  • 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.

Comments

Popular posts from this blog

LINUX Move and copy files using SSH

PHP Predefined Variables

Java : Variables Declaring