- Linux Hosting
- Tar Archive With Certain Files Using Wild Card Linux Command
this are some commands you can use to archive some selected files using a wildcard using a linux shell commands 
Wed Dec 31, 1969
hi, thanks for reading my post here.
i am sharing this helpful command to show you how you can use the wild card in a command using the tar command
for example, lets say i only want to include certain files in my archive, this is how i can do this:
tar -pczf foo.tar.gz wallpapers/007*.jpg
in my example above, i am creating a tar archive called foo.tar.gz that includes all wallpapers that start with 007
tar -pczf foo.tar.gz wallpapers/*007.jpg
in my example above, i am creating a tar archive called foo.tar.gz that includes all wallpapers that end with 007
to confirm you have only archived the files you wanted, you can list the files in the newly created tar archive by listing the files it contains:
tar -ztvf foo.tar.gz
done, hope this helps.