Preview:
#!/bin/bash

backup_dir="/home/akshatha/backup" #Define the backup directory

mkdir -p $backup_dir #Create the backup directory if does not exists

timestamp=$(date +'%Y%m%d_%H%M%S')

backup_filename="backup_${timestamp}.tar.gz"

tar czf "${backup_dir}/${backup_filename}" /home/akshatha/shell_script/

echo "Backup created: ${backup_dir}/${backup_filename}"

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter