09-08-2008
Quote:
Originally Posted by
aluiken
If the process is still running and did not yet close the file descriptor you can recover it directly via the file descriptor in /proc (on linux)
How to do this ? ( out of curiosity )
Did you mean the following steps ?
1) dup the file descriptor ( that is known )
2) use the new file descriptor to iterate through the contents of the file and store it again
Could you please shed more light on this ?
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi All,
I just given $rm abc.pc, I don't have backup also.
is there any way to recover?
thanks in advance
krishna (3 Replies)
Discussion started by: krishna
3 Replies
2. Filesystems, Disks and Memory
Right, a mate of mine screwed up today and deleted the entire contents of a directory and he really needs to get the files back. He's using Red Hat Enterprise Edition 4. The files were deleted using rm *. He can't remember if the hard drive was formatted using ext2 or ext3. Anybody have any idea... (0 Replies)
Discussion started by: Bacchus
0 Replies
3. UNIX for Dummies Questions & Answers
Hi
Is there any way to restore files accidentally deleted in Unix
(other than rm -i) (10 Replies)
Discussion started by: misenkiser
10 Replies
4. UNIX for Advanced & Expert Users
Hi
Is there a way by which I can recover the last deleted file file from a folder.
OR
I had a file in a path .(i didnt notice the size at that time ) I tried ftp that file to my windows but got file of zero size.
I want to check whether the file was already empty when I tried ftping it... (1 Reply)
Discussion started by: pratim09
1 Replies
5. SCO
Hi ,
I am using SCO openserver realease 3.2 and tried to test versioning on a directory with undelete -s . The command executes well but it is not creating any versions of the files in it. I have also setted versioning options via filesystem and then remounted it but of ... (0 Replies)
Discussion started by: dextergenious
0 Replies
6. Shell Programming and Scripting
Hi Friends,
I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving...
File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies
7. Shell Programming and Scripting
Hi,
I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file.
File1 - file2 = file3
wc -l file1.txt
58112
wc -l file2.txt
55260
head -5 file1.txt
101214200123
101214700300
101250030067
101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies
8. Solaris
is there a way to backup all inodes? (could that help with undeleting files?) (9 Replies)
Discussion started by: orange47
9 Replies
9. Shell Programming and Scripting
Shell script logic
Hi
I have 2 input files like with file 1 content as (file1)
"BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt
File 2 contents as fle(2)
"BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt
I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
DUP(2) System Calls Manual DUP(2)
NAME
dup, dup2 - duplicate a descriptor
SYNOPSIS
newd = dup(oldd)
int newd, oldd;
dup2(oldd, newd)
int oldd, newd;
DESCRIPTION
Dup duplicates an existing object descriptor. The argument oldd is a small non-negative integer index in the per-process descriptor table.
The value must be less than the size of the table, which is returned by getdtablesize(2). The new descriptor returned by the call, newd,
is the lowest numbered descriptor that is not currently in use by the process.
The object referenced by the descriptor does not distinguish between references using oldd and newd in any way. Thus if newd and oldd are
duplicate references to an open file, read(2), write(2) and lseek(2) calls all move a single pointer into the file, and append mode, non-
blocking I/O and asynchronous I/O options are shared between the references. If a separate pointer into the file is desired, a different
object reference to the file must be obtained by issuing an additional open(2) call. The close-on-exec flag on the new file descriptor is
unset.
In the second form of the call, the value of newd desired is specified. If this descriptor is already in use, the descriptor is first
deallocated as if a close(2) call had been done first.
RETURN VALUE
The value -1 is returned if an error occurs in either call. The external variable errno indicates the cause of the error.
ERRORS
Dup and dup2 fail if:
[EBADF] Oldd or newd is not a valid active descriptor
[EMFILE] Too many descriptors are active.
SEE ALSO
accept(2), open(2), close(2), fcntl(2), pipe(2), socket(2), socketpair(2), getdtablesize(2)
4th Berkeley Distribution May 13, 1986 DUP(2)