LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-24-2006, 04:47 AM   #1
dsids
Member
 
Registered: Mar 2006
Distribution: FC4
Posts: 184

Rep: Reputation: 31
terminal file descriptor?


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

Thanks
Danish
 
Old 04-24-2006, 05:22 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
To find the fd's used by a PID try "lsof -d 0-100 -a -p $PID".
 
Old 04-24-2006, 07:22 AM   #3
dsids
Member
 
Registered: Mar 2006
Distribution: FC4
Posts: 184

Original Poster
Rep: Reputation: 31
I did
#lsof -d 0-100 -a -p 4100

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

Danish
 
Old 04-24-2006, 10:43 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.

Last edited by unSpawn; 04-24-2006 at 10:45 AM. Reason: //have keybd, can't type
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the absolute path of file using file descriptor. appas Programming 7 01-19-2012 11:47 AM
File Descriptor 63 kshkid Programming 3 03-02-2006 11:41 AM
File Descriptor Limit rbd Linux - General 3 10-11-2004 01:57 PM
apt-file returns nothing; 'bad file descriptor' overbored Debian 3 10-03-2004 09:13 PM
File descriptor lido Linux - Newbie 5 07-17-2003 11:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration