Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to create .tgz file without creating .tar file? Post 302720449 by bakunin on Wednesday 24th of October 2012 07:32:08 AM
Old 10-24-2012
Quote:
Originally Posted by Pawan Kumar
tar -pczf MyBackup.tar.gz <file which needs to be inside>

will above command standard?

I have only concern is that wthether the above command generates tar file temporarily then delete afterwards? or it not at all generates tar file?
"tar" is a standard command. The standard version of "tar" has no "-z" switch at all, therefore you can't expect it to be able to understand it. Only the GNU version of "tar" has this extension. Therefore the second version Corona688 told you should be preferred. It will work everywhere, including GNU systems, while your version will work ONLY on GNU systems:

Code:
tar -cf - <files/paths to be included> | gzip > /path/to/output.tgz

It is generally better not to rely on extensions to the standard but to use only what the standard defines. By "standard" i mean POSIX here.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

script to create tar file

hello, im a newbie in unix scripting. can someone pls send me a sample script that will tar files in the folders of a specific directory, but will exclude specific files, and afterwards, will ftp the tar into another server. for example: in this directory, pshrprod:/opt/psoft/weblogic/818sp9_80... (2 Replies)
Discussion started by: ajrandrup
2 Replies

2. Shell Programming and Scripting

Error while creating .tar file using script

Hi, I am getting following error while running script: tar: can't change directories to /home/xyz/script: No such file or directory tar: compress: No such file or directory tar: getts.tar same as archive file Following is my script: #!/bin/bash echo "You want:" echo "1. zip... (1 Reply)
Discussion started by: Rakesh Bhat
1 Replies

3. UNIX for Dummies Questions & Answers

file.tgz.1of2 & file.tgz.2of2

Hi all, Need help. Anybody seen this kind of file before? file.tgz.1of2 file.tgz.2of2 how to extract this tgz file? Any help? Tq (5 Replies)
Discussion started by: zeedwolf
5 Replies

4. UNIX for Dummies Questions & Answers

Creating a Tar file while files are spooling

Hi I have done a search for this but couldn't find much on it. I am creating a tar file with the command below tar cvf /export/home/user/backup/*Will this is being created I have a job spooling to 5 texts files in the following directory /export/home/user/backup/STATS/ The tar files... (1 Reply)
Discussion started by: sgarvan
1 Replies

5. Solaris

How to extract files from a tar file without creating the directories?

Hello all. I have a tar file that contains a number of files that are stored in different directories. If I extract this tar file with -xvf , the directories get created. Is there a way to extract all of the files into one directory without creating the directories stored in the tar file. (9 Replies)
Discussion started by: gkb
9 Replies

6. UNIX for Advanced & Expert Users

Create corrupted *.tar.gz file ?

Hello. I`m writing a bash script who archive log files and send them to backup server. I need some kind of checking mechanism for *.tar.gz files. I found something like: gunzip -t file.tar.gz //Not output from it. And for tar: tar tf file.tar.gz //Only lists archive 1.) I need make a... (3 Replies)
Discussion started by: jabalv
3 Replies

7. Shell Programming and Scripting

Create tar file

Following are the list of files available in the dataout directory a1.txt.gz a2.txt.gz b3.txt.gzStep 1: now the tar file needs to be created as follows. tar -cvf ab.tar *.gzAll the files with extn .gzg has to be bundled in the tar file. Once the tar file is created, the files which are... (9 Replies)
Discussion started by: kmanivan82
9 Replies

8. Shell Programming and Scripting

How to create tgz file for all the directories in one time?

Hi, On server there is an one folder . which contains sub folder Eg - TEST folder contains test1, test2, execr ,tt (folder). also includes some text file like abc.txt psp.txt gg.log. here iwant to create tgz file for all the folders and file in one time. I know the command... (1 Reply)
Discussion started by: aish11
1 Replies

9. Windows & DOS: Issues & Discussions

[SOLVED] Creating .tar file

Hi, How to create a .tar file in windows OS.. I need to ftp tat <filename>.tar file into AIX and untar it there and will use for futher actions.. Please help.. Thanks in advance.. (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

10. AIX

How to install .tar.tgz file in AIX 6.1?

Hello, I have openssl.0.9.8.1103.tar.tgz file which I have downloaded from https://www14.software.ibm.com/webapp/iwm/web/reg/download.do?source=aixbp&S_PKG=openssl siteThe website says that the file name is openssl.0.9.8.1103.tar.z but when downloaded I get openssl.0.9.8.1103.tar.tgz as the... (2 Replies)
Discussion started by: gaugeta
2 Replies
GIT-TAR-TREE(1) 						    Git Manual							   GIT-TAR-TREE(1)

NAME
git-tar-tree - Create a tar archive of the files in the named tree object SYNOPSIS
git tar-tree [--remote=<repo>] <tree-ish> [ <base> ] DESCRIPTION
THIS COMMAND IS DEPRECATED. Use git archive with --format=tar option instead (and move the <base> argument to --prefix=base/). Creates a tar archive containing the tree structure for the named tree. When <base> is specified it is added as a leading path to the files in the generated tar archive. git tar-tree behaves differently when given a tree ID versus when given a commit ID or tag ID. In the first case the current time is used as modification time of each file in the archive. In the latter case the commit time as recorded in the referenced commit object is used instead. Additionally the commit ID is stored in a global extended pax header. It can be extracted using git get-tar-commit-id. OPTIONS
<tree-ish> The tree or commit to produce tar archive for. If it is the object name of a commit object. <base> Leading path to the files in the resulting tar archive. --remote=<repo> Instead of making a tar archive from local repository, retrieve a tar archive from a remote repository. CONFIGURATION
tar.umask This variable can be used to restrict the permission bits of tar archive entries. The default is 0002, which turns off the world write bit. The special value "user" indicates that the archiving user's umask will be used instead. See umask(2) for details. EXAMPLES
git tar-tree HEAD junk | (cd /var/tmp/ && tar xf -) Create a tar archive that contains the contents of the latest commit on the current branch, and extracts it in /var/tmp/junk directory. git tar-tree v1.4.0 git-1.4.0 | gzip >git-1.4.0.tar.gz Create a tarball for v1.4.0 release. git tar-tree v1.4.0^{tree} git-1.4.0 | gzip >git-1.4.0.tar.gz Create a tarball for v1.4.0 release, but without a global extended pax header. git tar-tree --remote=example.com:git.git v1.4.0 >git-1.4.0.tar Get a tarball v1.4.0 from example.com. git tar-tree HEAD:Documentation/ git-docs > git-1.4.0-docs.tar Put everything in the current head's Documentation/ directory into git-1.4.0-docs.tar, with the prefix git-docs/. GIT
Part of the git(1) suite Git 1.8.3.1 06/10/2014 GIT-TAR-TREE(1)
All times are GMT -4. The time now is 07:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy