I am looking for a Unix command which will create a tar of 10 files from a directory.
+3
A:
Well, depending on your needs...
$ tar cf tenfiles.tar file1 file2 file3 ... file10
That'll do it. You can check out the tar manpage ($ man tar
) for further details on other options you might need. (Your question was a bit vague, so I can't be that much more specific.)
mipadi
2009-11-17 13:38:50
A:
Can you define what files are they? Are they of a specific filename pattern? My reasoning is asking that you specified 10 files.
In general:
tar cvf tar_with_10_files.tar somefile_with_wildcards_or_pattern_matching
tommieb75
2009-11-17 13:39:13
A:
tar -cvf name.tar /path/to/file1 /path/to/file2 /path/to/file3 ...
Soufiane Hassou
2009-11-17 13:39:21
+5
A:
tar cf path_of_tar.tar $(ls | head -10)
Add options to ls to select the 10 you want.
bmargulies
2009-11-17 13:39:21
Thanks :-) ...Wish I could mark your answer useful...
Ritz
2009-11-17 13:45:02
Just mark it 'accepted'. You asked the question, I think you can always do that.
bmargulies
2009-11-17 15:03:46
A:
I would suggest trying:
man tar
This will show all the options available and usage information. A typical usage for creating a tar of files in a directory would look like this:
tar -cvf myfiles.tar ./mydirectory
where myfiles.tar is the name of the tar file you want to create, and mydirectory is the directory the files reside in.
mmorrisson
2009-11-18 19:07:27