Shubam Bharti
Shubam Bharti

Reputation: 73

Find where I/O file descriptors of a process are pointing in proc

I ran a command $./cpu-print > /tmp/tmp.txt &. Now I need to go to the proc folder of this process, and describe where its I/O file descriptors 0, 1, 2 are pointing to. How can I do this?

Upvotes: 1

Views: 752

Answers (1)

SKi
SKi

Reputation: 8466

Maybe ls from the /proc/<pid>/fd directory contains the wanted information:

> ls -l /proc/`pidof cpu-print`/fd 

lrwx------ 1 ccc ccc users 64 Mar  9 12:46 0 -> /dev/pts/2
l-wx------ 1 ccc ccc users 64 Mar  9 12:46 1 -> /tmp/tmp.txt 
l-wx------ 1 ccc ccc users 64 Mar  9 12:46 2 -> /dev/null
lrwx------ 1 ccc ccc users 64 Mar  9 12:46 3 -> /dev/pts/2

Upvotes: 2

Related Questions