Search code examples
linuxubuntuvisual-studio-code

Accidentally delete file in visual studio code with remote ssh and cannot ctrl+z in Explorer View


I used ubuntu and ssh by shh-remote extension to another ubuntu server, and I accidentally deleted a folder containing important files by pressing the delete key. I pressed "ctrl+z" but it did not restore. What did vsc actually do? How did I recover the deleted files (either by Visual Studio Code or by another way)?

update: I use testdisk to recover but it show "ok" quite low, and "failed" quite high? Many thanks.


Solution

  • You cannot recover files you have deleted with SSH through the VSCode editor built-in properties like Ctrl-Z. Operations on the disk are the responsibility of the operating system.

    If you have not GUI acces to OS maybe you can look at the

    ls /home/$USER/.local/share/Trash

    or if your files deleted with root privileges

    ls /root/.local/share/Trash

    If your files are not deleted permanently you can restore with Trash-CLI program:

    sudo apt install trash-cli

    then put this command to terminal

    trash-restore

    If your files deleted permanently check this link for file recovery:

    How to Recover Deleted Files in Ubuntu Through TestDisk