how to convert directory to a tar file in linux code example Example: how to tar linux tar -zcvf file.tar.gz /path/to/dir/