Screen: recover deleted running script

Code examples

0
0

screen: recover deleted running script

## How to recover a running script from a terminal session
## If a running program still has the deleted file opened,
## you can recover the file through the open file descriptor
## in /proc/[pid]/fd/[num].

## To determine if this is the case, you can attempt the following:

# look for the script's pid using ps

$ ps -ef|grep script.sh


# you should get an output like this:

$ Fdo  8983  8463  0 12:28 pts/2    00:00:00 /bin/bash ./script.sh

## take note of the PID (8983) in the second column,
## Using this information you can recover the file by issuing the command:

$ cp /proc/8983/fd/255 /path/to/restored/file.txt

## the 255 is basically used for deleted files.
## you can now open /path/to/restored/file.txt, you'll see the 
## content of the deleted file.

# Good luck

Similar pages

Similar pages with examples

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................