Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Using Tar with a Text Input File

July 09, 2023 — Gregg Szumowski

If you have a lot of files in a directory and you only need to tar a subset of them you can create a list of the files you want in a text file and pass it to the tar command like this:

$ tar -cvf tarball.tar -T filelist.txt

or

$ tar cvf tarball.tar $(cat filelist.txt)

Tags: cli, tar, motd