LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 05: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, 06:22 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531
To find the fd's used by a PID try "lsof -d 0-100 -a -p $PID".
 
Old 04-24-2006, 08: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, 11:43 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531
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 11:45 AM. Reason: //have keybd, can't type
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:47 PM
File Descriptor 63 kshkid Programming 3 03-02-2006 12:41 PM
File Descriptor Limit rbd Linux - General 3 10-11-2004 02:57 PM
apt-file returns nothing; 'bad file descriptor' overbored Debian 3 10-03-2004 10:13 PM
File descriptor lido Linux - Newbie 5 07-17-2003 12:58 PM


All times are GMT -5. The time now is 10:40 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration