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 [ options ] [ file… ]


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. Command line arguments permit you to back up just the current directory (without subdirectories) or specific files in the current directory or elsewhere.


Back up only the current directory (no subdirectories).
Print how to call information.


If one or more files or directories are named on the command line, just those will be backed up. Otherwise, all files in the current directory and any subdirectories (unless the −n option is specified) are backed up.

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 the Unix commands chmod, cut, date, du, find, gzip, sed, tar, and tr behave as the GNU versions do. If these commands behave differently on your system, you'll need to modify the script accordingly. A system with classic System V commands will probably require modification of the du and find command options (the latter required only when the −n option is specified).

Download flashback.tar.gz (Gzipped TAR archive)

The program is provided as flashback.tar.gz, a Gzipped archive containing the flashback shell script and this document. Prior releases remain available.


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.

Valid XHTML 1.0
by John Walker
February 15th, 2006
Updated: June 17th, 2021
Updated: July 31st, 2021