Up to $140 off-Lowest  Prices of 2024(Nov.21-Dec.2)

My Computer Tips

Home | About | Categories | All Tips & Tutorials

Compress folder in tar.gz format using the terminal in Linux. Add current date to filename

ID: 380

Category: Linux Terminal

Added: 3rd of November 2024

Views: 141



Click here to buy Linux books on Amazon
Affiliate Link ⓘ


To compress a folder in tar.gz format and also add the date in UK format to the file name, enter the following command.
tar -zcvf "backup_folder_name-$(date +"%d-%m-%Y").tar.gz" backup_folder_name

To add the date in US format to the file name, enter the following command.
tar -zcvf "backup_folder_name-$(date +"%m-%d-%Y").tar.gz" backup_folder_name

%d=date
%m=month
%Y=year

Related Tips & Tutorials

Compress folder in zip format using the terminal in Linux. Add current date to filename