LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   A useful tar command on AIX/Solaris does not seems work on Linux (https://www.linuxquestions.org/questions/linux-newbie-8/a-useful-tar-command-on-aix-solaris-does-not-seems-work-on-linux-4175508520/)

EricChiang 06-19-2014 01:04 PM

A useful tar command on AIX/Solaris does not seems work on Linux
 
Hi,
tar -cvpf - *|compress > file_name.tar.Z
zcat file_name.tar.Z|tar -xvpf -

Above 2 commands (tar & untar) are quite usful to handle my job.
Company has plan to switch unix plat form from AIX/Solaris to Linux in the near future.
How to make above tar & untar commands work in Lieux?
The tar comand above includes sub-folders in a huge main folder and includes all hidden files on all sub-folders.
Your help is highly appreciate.

Thanks! ---Eric

schneidz 06-19-2014 01:13 PM

i usually use
Code:

tar -cvjf archive.tar.bz2 /whatever/floats/your/boat # archive and compress
tar -xvjf archive.tar.bz2 # extract


TB0ne 06-19-2014 01:14 PM

Quote:

Originally Posted by EricChiang (Post 5190692)
Hi,
tar -cvpf - *|compress > file_name.tar.Z
zcat file_name.tar.Z|tar -xvpf -

Above 2 commands (tar & untar) are quite usful to handle my job. Company has plan to switch unix plat form from AIX/Solaris to Linux in the near future.
How to make above tar & untar commands work in Lieux? The tar comand above includes sub-folders in a huge main folder and includes all hidden files on all sub-folders. Your help is highly appreciate.
Thanks! ---Eric

If you're already a Unix administrator, you are no doubt familiar with the man pages; have you read the man page on the Linux tar command??
http://linux.die.net/man/1/tar

From what you posted, it seems like all you're after is the ability to compress/decompress the tar files...so:
Code:

-j, --bzip2
    filter the archive through bzip2
-J, --xz
    filter the archive through xz
-z, --gzip
    filter the archive through gzip

...which gives you THREE options for file compress. So just adding a 'z' to your existing tar command will do it on Linux, no need for piping to compress. Same for uncompressing

jefro 06-19-2014 04:56 PM

You'd have to also double check the version and maybe build of the tar you have. You may have two programs or more of tar.

Generally the man page follows correctly for the version.


All times are GMT -5. The time now is 06:02 AM.