I would like to know if there is a way to roll-back shell commands : for example rolling back a rm -rf command.
Asked
Active
Viewed 8,728 times
4
Bionix1441
- 167
2 Answers
12
There is no way to "roll back" shell commands.
If you removed a file using rm command, you can only try to restore it using testdisk or a similar software.
Some of shell commands can be rolled back by other shell commands.
For example, if file.txt did not exist, command
echo "bla bla bla" > file.txt
can be rolled back by
rm file.txt
If file.txt had some content, the first command can't be rolled back.
So you need to be very careful using shell commands!
6
In general, a shell command could do anything to the system, and there is no omnipotent undo mechanism within Ubuntu.
However, if you run Ubuntu as a guest inside a virtual machine, you could take a snapshot of the virtual machine, which would give you the ability to rollback to the snapshot.
200_success
- 1,259
- 12
- 22