LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   terminal file descriptor? (https://www.linuxquestions.org/questions/linux-newbie-8/terminal-file-descriptor-438273/)

dsids 04-24-2006 04:47 AM

terminal file descriptor?
 
Hi Everybody,
How would we come to know what is the file desciptors of the terminals...

Thanks
Danish

unSpawn 04-24-2006 05:22 AM

To find the fd's used by a PID try "lsof -d 0-100 -a -p $PID".

dsids 04-24-2006 07:22 AM

I did
#lsof -d 0-100 -a -p 4100

but the promt just came back without any kind of output....

Danish

unSpawn 04-24-2006 10:43 AM

Which could mean the PID was either too short-lived for Lsof to find any open fd's or it didn't use any fd's?

Say (stupid example) you would want to find fd's zero to hundred for all instances of Apache. You could get a list of pids, knowing Apache is called "httpd", and feed it to xargs which in turn will run lsof:
Code:

pgrep -f httpd|xargs -iP lsof -d 0-100 -a -p 'P'
Likewise you can do for any app you're wanting to find fd's for.


All times are GMT -5. The time now is 07:21 AM.