subject: How To Work With Tar In Unix [print this page] The most common way in storing and keeping track of your files in UNIX is by using the application "TAR". The TAR application in UNIX enables you to not only archive your needed files, but it also helps you distribute these files in a network with the use of software specific for the job. In example, FTP servers or through the use of torrents. TAR does the work for both you with as little hassle as possible. There's only a few steps for you to follow through in order to do so.
First off, you have to open the terminal session of your UNIX-run PC. The terminal is where you can input command lines to initialize UNIX functions. Or if you are far away from your machine, you use Telnet which is like a remote terminal.
The command that you have to learn over and over again when dealing with TAR files is "tar -cf filename.tar". This is the first command in a series. Basically, you have to write 'tar' then a space by which you place '-cf' then another space, and the the file name that you want to have extracted (or more commonly the "tarball").
After that, input the complete and full path of the directory where the tarball is located. Take note that if unless you're issuing the command from the same directory, you only have to specify the folder and the file name, instead of having the whole directory. Make sure that the file you want to compress is complete with its extension. Otherwise, the command will fail and the file will not be compressed. Press 'Enter' and your tar file with the file inside, will be created.
To extract and distribute the files, the command that you will follow is "tar xf filename". This command will allow you to extract and distribute all the files inside a network of their choosing. The 'x' in the command stands for the extract command and 'f' stands for the TAR file that needs to be extracted from the tar ball.