Restore Older Versions of Files
KDE Linux automatically takes snapshots of files in your home folder so you can restore older versions — even without an off-device backup.
Snapshots are periodically pruned so that only a maximum of 19 are retained, to avoid using too much disk space. Old versions of files are kept for up to 2 months; after that, their snapshot is pruned.
Restore an older version of a file
- Open Dolphin and navigate to the file.
- Right-click on the file.
- Select View snapshots….
- Select the version of the file you’d like to restore.
- Copy the file.
- Leave the snapshots view.
- Paste the file.
- In the dialog window that appears, click Overwrite.
Restore a file that was accidentally deleted
- Open Dolphin and right-click on the folder which contained the deleted file.
- Select Browse snapshots…
- This takes you to a view showing all the available snapshots sorted by date.
- Enter the desired snapshot and navigate to the place where the deleted file used to be.
- Copy the file.
- Leave the snapshots view.
- Navigate to the place where you’d like the file to be restored
- Paste the file.
Manually take a new snapshot
The system automatically takes a new snapshot every hour, but you can do it manually, too. There are two options, depending on the desired lifetime of the new snapshot:
1. Pruned automatically on the standard schedule
Use a terminal window to run snapper --config home_$(id -u) create --cleanup-algorithm timeline.
2. Pruned only when you do it manually
Use a terminal window to run snapper --config home_$(id -u) create --description [desc].
Replace [desc] with some text to remind yourself of why you made this snapshot!
Manually prune a snapshot
First see the list of snapshots for your user by using a terminal window to run snapper --config home_$(id -u) list.
Then prune the desired snapshot: snapper --config home_$(id -u) delete --sync [id].
Replace [id] with the number of the snapshot you want to delete, or multiple IDs separated by spaces (for example, 1 6 27), or a range (for example 25-157).
Turn the snapshot system off and on
To turn the snapshot system off, use a terminal window to run systemctl disable --now snapper-timeline.timer.
To turn it back on again, run systemctl enable --now snapper-timeline.timer.
More information
- Run
man snapperin a terminal window to see all options. - Read the Arch wiki documentation for Snapper to learn more tips and tricks.
Article contributed by Nate Graham under the CC-BY-4.0 license.