Creating a Tar Archive

They have: 141 posts

Joined: Aug 1999

I know the command is tar -c filename, but how do you specify where to create the filename

They have: 5,633 posts

Joined: Jan 1970

hi Randall!

Just include the full path to the filename, like:

tar -cvf /home/randall/mytar.tar mydir

btw. the flags you most use:

-v verbose, print detailled output
-f follow, also adds subdirs
-z zip, gzip the tar when done

They have: 122 posts

Joined: Jun 2000

-f actually specifies the filename of the tar archive
tar -cvf filename.tar files.to.be.included and.dirs.too/
would create a tar archive with the name of filename.tar that includes both the file 'files.to.be.included' and the directory 'and.dirs.too/' along with any subdirectories of that and any files in it.

Rob Radez
OSInvestor.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.