LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-16-2006, 10:53 PM   #1
RajRed
Member
 
Registered: Mar 2005
Posts: 66

Rep: Reputation: 15
find the total number of pseudo terminals of all logins


how do I find the total number of the pseudo terms used on the system?

Thanks.
 
Old 04-17-2006, 03:28 AM   #2
norbert74
Member
 
Registered: Apr 2006
Posts: 63

Rep: Reputation: 23
You may look into /dev/pts/. There you find all pseudo terminal slave devices currently being used.
The total number is the highest number there + 1
Watch the changes by opening and closing xterms. More info in "man pts".

Norbert
 
Old 04-17-2006, 09:03 AM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Not quite. #'s can be skipped due to closing of terminals, from my system a few moments ago:
Code:
$ ls /dev/pts/
0  1  2  3  4  5  7
Notice that '6' is missing.


What will work is: ls /dev/pts/ | wc -l
Code:
$ ls /dev/pts/  | wc -l
8
This counts the # of open terminals reported.
 
Old 04-17-2006, 07:11 PM   #4
RajRed
Member
 
Registered: Mar 2005
Posts: 66

Original Poster
Rep: Reputation: 15
When I did 'ls /dev/pts | wc -l', it also counts the '.' and '..'. How do I exclude the '.' and '..' or not to count these two?
 
Old 04-18-2006, 12:42 AM   #5
norbert74
Member
 
Registered: Apr 2006
Posts: 63

Rep: Reputation: 23
This should count only numerical entries in the directory:
ls /dev/pts | grep "[0-9]" | wc -l
 
Old 04-18-2006, 04:30 AM   #6
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Your ls has probably been aliased to something like ls -a, try using:
Code:
 'ls' /dev/pts/ | wc -l
The quoting bypasses the aliasing.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I see the total number of file locks being currently used? abefroman Linux - Software 1 11-08-2005 06:16 PM
How to add pseudo-terminals to /dev directory (Mandrake 10.1 & udev) blubery Mandriva 1 08-06-2005 12:46 PM
Regarding Pseudo tty, Pseudo terminals ? mqureshi Programming 0 07-30-2005 10:51 AM
List total number of directories paraiso Linux - Newbie 5 04-18-2005 04:04 AM
managing pseudo terminals in an ssh session kirkhamster1 Linux - Newbie 1 10-08-2003 12:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:11 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
Open Source Consulting | Domain Registration