crasch (crasch) wrote,

GEEK: How to tar up a list of filenames

Suppose you have a file named "files.txt" that contains the following list of filenames:


If you want to tar up the actual files you can do so with this command:

cat files.txt | xargs tar cvzf files.tgz

cat - displays the contents of files.txt
| - pipes the output of cat to xargs
xargs - reads the filenames passed to it by cat, and executes tar with them as arguments
c - create tar file
v - verbose
z - gzip the resulting tar file
f - write to file
files.tgz - the name of the file
Tags: geek, programming, tar
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened