tar -pczf <target_file.tar.gz> --exclude /path/to/exclude --exclude /another/path/to/exclude/* /path/to/include/ /another/path/to/include/*
Tested in Ubuntu 19.10.
=
after exclude
is optional. You can use =
instead of space after keyword exclude
if you like.exclude
must be placed before the source.