httm
The dream of a CLI Time Machine is still alive with httm
.
httm
prints the size, date and corresponding locations of available unique versions (deduplicated by modify time and size) of files residing on snapshots, but can also be used interactively to select and restore such files. httm
might change the way you use snapshots (because ZFS/btrfs aren't designed for finding for unique file versions) or the Time Machine concept (because httm
is very fast!).
httm
boasts an array of seductive features, like:
- Search for and recursively list all deleted files. Even browse files hidden behind deleted directories.
- List file snapshots from all local pools (
httm
automatically detects local snapshots as well as locally replicated snapshots)! - List file snapshots from remote backup pools (you may designate replicated remote snapshot directories).
- Supports ZFS and btrfs snapshots
- For use with even
rsync
-ed non-ZFS/btrfs local datasets (like ext4, APFS, or NTFS), not just ZFS/btrfs. - Specify multiple files for lookup on different datasets
- 3 native interactive modes: browse, select and restore
- ANSI
ls
colors from your environment - Non-blocking recursive directory walking (available in all interactive modes)
- Select from several formatting styles. Parseable ... or not ... oh my!
Use in combination with you favorite shell (hot keys!) for even more fun.
Inspired by the findoid script, fzf and many zsh key bindings.
Install via Native Packages
For Debian-based and Redhat-based Linux distributions (like, Ubuntu or Fedora, etc.), check the tagged releases for native packages for your distribution.
You may also create and install your own native package from the latest sources, like so:
|
;
# to install on a Debian/Ubuntu-based system
# or convert to RPM
# and install on a Redhat-based system
For Arch-based Linux distributions, you can create and install your own native package from the latest sources, like so:
# you need to edit the PKGBUILD as needed to conform to the latest release
Install via Source
The httm
project contains only a few components:
-
The
httm
executable. To build and install:|
-
The optional
zsh
hot-key bindings: UseESC+s
to select snapshots filenames to be dropped to your command line (for instance after thecat
command), or useESC+m
to browse for all of a file's snapshots. After you install thehttm
binary, to copy the hot key script to your home directory, and source that script within your.zshrc
: -
The optional
man
page:cargo
has no native facilities for man page installation (though it may in the future!). You can usemanpath
to see the various directories your system uses and decide which directory works best for you. To install, just copy it to a directory in yourman
path, like so:
Caveats
Right now, you will need to use a Unix-ish-y Rust-supported platform to build and install (that is: Linux, Solaris/illumos, the BSDs, MacOS). Note, your platform does not need to support ZFS/btrfs to use httm
. And there is no fundamental reason a non-interactive Windows version of httm
could not be built, as it once did build, but Windows platform support is not a priority for me right now. Contributions from users are, of course, very welcome.
On FreeBSD, after a fresh minimal install, the interactive modes may not render properly, see the linked issue for the fix.
On some Linux distributions, which include old versions of libc
, cargo
may require building with musl
instead, see the linked issue.
Example Usage
Note: You may need to use sudo
(or equivalent) to view versions on btrfs datasets.
Print all unique versions of your history file:
Print all files on snapshots deleted from your home directory, recursive, newline delimited, piped to a deleted-files.txt
file:
Browse all files in your home directory, recursively, and view unique versions on local snapshots:
Browse all files deleted from your home directory, recursively, and view unique versions on all local and alternative replicated dataset snapshots:
Browse all files in your home directory, recursively, and view unique versions on local snapshots, to select and ultimately restore to your working directory:
Browse all files, recursively, in your MacOS home directory backed up via rsync
to a ZFS/btrfs remote share, shared via smbd
, and view unique versions on remote snapshots:
# mount the share
# set the location of you snapshot share point and local relative directory
# execute httm
View the differences between each unique snapshot version of .zshrc
and the live file:
filename=" /.zshrc"
for; do
# check whether files differ (e.g. snapshot version is identical to live file)
if ; then
# print that version and file that differ
# print the difference between that version and file
fi
done
Create a simple tar
archive of all unique versions of your /var/log/syslog
:
|
Create a kinda fancy tar
archive of all unique versions of your /var/log/syslog
:
# a slightly fancier GNU tar folder structure
file="/var/log/syslog"
dir_name=""
base_dir=" _all_versions"
|
Create a super fancy git
archive of all unique versions of /var/log/syslog
:
# create variable for file name
file="/var/log/syslog"
# create git repo
; ;
# copy each version to repo and commit after each copy
for; do
# amend commit date to match snapshot modify time
done
# create git tar.gz archive
# and to view
I know what you're thinking, but slow your roll.
License
httm is licensed under the MPL 2.0 License - see the LICENSE file for more details.