Reputation: 2332
I am looking for a Unix command which will create a tar of 10 files from a directory.
Upvotes: 1
Views: 20276
Reputation: 541
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.
Upvotes: 1
Reputation: 34592
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
Upvotes: 0
Reputation: 100133
tar cf path_of_tar.tar $(ls | head -10)
Add options to ls to select the 10 you want.
Upvotes: 10
Reputation: 17750
tar -cvf name.tar /path/to/file1 /path/to/file2 /path/to/file3 ...
Upvotes: 0
Reputation: 410952
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.)
Upvotes: 2