What is Timeshift?
Timeshift is a great tool, which monitors your system & application-level changes and gives you the ability to roll back your system in the previous state, in case, you run into a problem (Similar like Windows restore point)
Why should you use the Timeshift from the Command line/Terminal when you have a GUI version?
Well, using the timeshift in GUI mode is absolutely fine. Nothing to complain here. However, imagine a situation, where your video driver is broken due to some unstable update or maybe something terrible happens with your system and you are not able to use the Timeshift GUI version to rollback your system to the previous state, then you have only the Timeshift CLI option available.
How to use Timeshift from the command line?
At first, make sure that the timeshift is installed in your system. If not, then install it using sudo apt install timeshift
Creating a Restore point
Now, launch your terminal and type the following command
sudo timeshift --create --comments "A new backup" --tags D
(Creating a restore point/snapshot may take several minutes, depends on the size of the files & your hardware resources)
-- comments "A new backup"
You can write anything as a comment, it doesn't matter that much.
--tags D
There are several tags, that specify what kind of backup it is.
As an example
--tags D
stands for Daily Backup
--tags W
stands for Weekly Backup
--tags M
stands for Monthly Backup
--tags O
stands for On-demand Backup
You can put any tag as your wish, after the comments
Restoring a snapshot
sudo timeshift --restore
This command shows you a list of created snapshots & ask, from which snapshot you want to restore the system, you have to select the snapshot index to proceed further
After that, press the Enter key to continue, when It asks about reinstalling the GRUB2 bootloader, press the 'y' key, then press the Enter key again & finally, press the 'y' key to start the system restore...
At this moment, you have restored the system successfully, and the PC will take a reboot to ensure that your restoration is fully done.
(**When your PC is in the restoring phase, don't do any work. It might interfere with the restoring process.)
Watch on YouTube
Thanks for the reading :)
Top comments (6)
Thanks. Managed a system recovery from "Failed to start light display manager".
Regards,
Vincent
Thanks.
with CLI, how do you specify the target device?
I am not sure though but it should be something like this...
sudo timeshift --create --comments "new backup" --tags D --snapshot-device /dev/sda1
(
/dev/sda1
is an example of your target device location)Otherwise, you can edit the config file in /etc/timeshift/timeshift.json to change the default target.
Curiously I installed timeshift on an Ubuntu server:
sudo apt install timeshift
and I find two config file candidates:
with puzzling dates no less. And the contents are far from clear or well documented anywhere:
albeit identical in the two files. I find the dearth of documentation here:
github.com/teejee2008/timeshift
on the config file (location and contents) mildly frustrating (but not totally surprising or disconcerting as it is FOSS and I know the deal and am overridingly grateful just for its existence and reliability).
But the most interesting thing, and real reason I drop comment here is that the config file lacks any evidence of
snapshot-device
having onlybackup_device_uuid
(which I might infer - though would prefer to see documented - is the device that is being backed up not the device being backed up to - the source, not the destination). And I might guess further that addingsnapshot-device
to the config file might work, but would remain curious if we can't specify a target folder (rather than device).