Archiving and compressing
|
There are a number of options for archiving and compressing directories and files at HPC2N. tar (more information) Examples: archive a file p-bc9901 [~/testdir]$ tar cvf myfile.tar myfile.txt myfile.txt p-bc9901 [~/testdir]$ archive and compress a file p-bc9901 [~/testdir]$ tar cvfz myfile.tar.gz myfile.txt myfile.txt p-bc9901 [~/testdir]$ list contents of a tar file p-bc9901 [~/testdir]$ tar tvf myfile.tar -rwxr-xr-x username/folk 23717 2009-10-02 15:48:48 myfile.txt p-bc9901 [~/testdir]$ extract contents of a tar file p-bc9901 [~/testdir]$ tar xvf myfile.tar myfile.txt p-bc9901 [~/testdir]$ extract contents of gzipped tar-archive p-bc9901 [~/testdir]$ tar xvfz myfile.tar.gz myfile.txt p-bc9901 [~/testdir]$ archive and compress all files in a directory to a single tar file p-bc9901 [~/testdir]$ tar cvfz mydir.tar.gz C/ C/ C/hello C/hello.c C/hello_submit p-bc9901 [~/testdir]$ archive and compress all files of a certain type (here .c) to a single tar-file(only those in current directory and below) p-bc9901 [~/testdir]$ tar cvfz myfile.tar.gz *.c calc.c converting.c hello.c p-bc9901 [~/testdir]$ gzip (more information) compress a file (also removes the uncompressed file) p-bc9901 [~/testdir]$ gzip myfile.txt p-bc9901 [~/testdir]$ uncompress a file (also removes the compressed file) p-bc9901 [~/testdir]$ gunzip myfile.txt.gz p-bc9901 [~/testdir]$ bzip2 (more information) compress a file (also removes the uncompressed file) p-bc9901 [~/testdir]$ bzip2 myfile.txt p-bc9901 [~/testdir]$ uncompress a file (also removes the compressed file) p-bc9901 [~/testdir]$ bunzip2 myfile.txt.bz2 p-bc9901 [~/testdir]$ zip (more information) Zip examples: compressing myfile.txt p-bc9901 [~/testdir]$ zip myfile.zip myfile.txt adding: myfile.txt (deflated 57%) p-bc9901 [~/testdir]$ uncompressing myfile.zip (if the file already exists, zip will ask if you want to replace or rename) p-bc9901 [~/testdir]$ unzip myfile.zip Archive: myfile.zip inflating: myfile.txt p-bc9901 [~/testdir]$ compress all files in one directory to a single archive file p-bc9901 [~/testdir]$ zip -r mydir.zip C/ adding: C/ (stored 0%) adding: C/hello (deflated 66%) adding: C/hello.c (deflated 3%) adding: C/hello_submit (deflated 24%) p-bc9901 [~/testdir]$ compress all files of a certain type in the current directory (and in directories under this) to a single archive file p-bc9901 [~/testdir]$ zip -r my_c_files.zip . -i \*.c adding: hello.c (deflated 3%) adding: C/hello.c (deflated 3%) adding: converting.c (deflated 31%) adding: calc.c (deflated 5%) p-bc9901 [~/testdir]$ There are a number of Windows programs using the same formats. These are a few of the more popular ones: |



