I accidentally deleted a file - can I get it back?
This depends on where the file was and when it was created and deleted.
/scratch
There is no backup and no snapshots so the file is gone forever.
/users
If it was in your home directory /users/<username>
then you can recover files from up to 7 days ago using the built-in snapshots by navigating to the hidden .snapshot
directory as follows:
[ulambda@login1 ~]$ pwd
/users/ulambda
[ulambda@login1 ~]$ date
Tue Jan 14 12:00:00 CET 2020
[ulambda@login1 ~]$ cd .snapshot
[ulambda@login1 .snapshot]$ ls
2020.01.08.01.00.02.HPCU_user
2020.01.09.01.00.01.HPCU_user
2020.01.10.01.00.01.HPCU_user
2020.01.11.01.00.01.HPCU_user
2020.01.12.01.00.01.HPCU_user
2020.01.13.01.00.01.HPCU_user
2020.01.14.01.00.01.HPCU_user
[ulambda@login1 .snapshot]$ cd 2020.01.10.01.00.01.HPCU_user
[ulambda@login1 2020.01.10.01.00.01.HPCU_user]$ ls
..
my_deleted_file
..
..
If the file was in a subdirectory then you can also open .snapshot
directly in the affected directory.
The snapshots are taken at 1am in the morning so if you created a file in the morning and deleted it the same afternoon then we can't help.
Beyond 7 days the file is lost forever.