Archive And Unarchive Files

Make Directory

mkdir regiment_data

Make Files In Directory

touch regiment_data/battles.txt regiment_data/regiment.txt

Compress Directory

Here we create (c) an archive file from the directory regiment_data called file (f) called regiment.tar.

tar cf regiment.tar regiment_data

View Contents Of Directory

ls -l
total 24
drwxrwxr-x 2 chris chris  4096 Jul 31 13:23 regiment_data
-rw-rw-r-- 1 chris chris 10240 Jul 31 13:25 regiment.tar

Uncompress Directory

Here we unarchive (x) the archived file (f) called regiment.tar.

tar xf regiment.tar

View Contents Of Directory

ls -l
total 24
-rw-rw-r-- 1 chris chris    36 Jul 31 13:17 battles.txt
drwxrwxr-x 2 chris chris  4096 Jul 31 13:23 regiment_data
-rw-rw-r-- 1 chris chris 10240 Jul 31 13:25 regiment.tar
-rw-rw-r-- 1 chris chris    46 Jul 31 13:17 regiment.txt