Instant Directory Backup for Unix

This page describes flashback, a Unix shell script which creates snapshot backups of the current directory (including any subdirectories) into a designated backup directory. Use flashback frequently when you're consumed in a coding frenzy and you'll never again suffer the anguish of accidentally typing "rm * .o" and losing a day's work.

This page describes flashback in Unix manual page style; the program may be downloaded from the link at the bottom.


flashback - create snapshot backup of current directory




Flashback makes a gzipped tar snapshot of the directory you're working in (and any subdirectories) to a common backup directory from which you can restore clobbered files when needed. Flashback reports the size of the backup directory after adding the new backup so you'll know when it's time to clean up old backups.




Flashback writes backups in the directory defined by the WHERE variable in the script. This defaults to "$HOME/FLASHBACK", a directory named FLASHBACK in the user's home directory. If this directory doesn't exist, flashback prompts whether it should be created. Backup files are named with the fully-qualified path name of the directory backed up with all slashes replaced by hyphens, followed by the date and time in ISO 8601 format (yyyy-mm-dd-HH-MM-SS).

For an additional degree of security, you might want to modify the WHERE variable to place backups on a different computer (with a writable file system mounted on the machine on which you usually edit), or on a different physical storage device than the one where you do most of your work. That way, even after a screeching drive disaster or smoke incident, you'll be able to recover your work up to the last flashback.


Flashback distinguishes multiple backups of the same directory by appending the date and time to the second. If you run flashback more than once in a second, all but the first backup will fail because the backup file names are identical and backup files are write protected.

Flashback is a Unix shell script, written for the Bourne shell, and will require modifications on systems with incompatible shells. It is completely useless on non-Unix systems.

Flashback assumes standard System V behaviour for the Unix commands chmod, cut, date, du, gzip, sed, tar, and tr. If these commands behave differently on your system, you'll need to modify the script accordingly.

Download flashback.zip (Zipped archive)

The program is provided as flashback.zip, a Zipped archive containing the flashback shell script and this document.


gzip(1), tar(1)


flashback returns status 0 if processing was completed without errors and 1 if the backup could not be made.


This software is in the public domain. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, without any conditions or restrictions. This software is provided "as is" without express or implied warranty.

by John Walker
April 13th, MM