Here is the sample code.
I made the original post to get some ideas from anyone out there. Well...no luck! However, I talked to some clever linux aficionados at Orange County Linux Users Group here in Southern California and here is the sample codes:! I tried them all out and they worked like a charm.
One way:
> $ ls /dev/pts/* | wc -l
>
> Another:
> $ finger | grep -wc pts
>
> One more way:
> $ ps faux | tr -s ' ' '\t' | cut -f 7 | grep -w pts | sort | uniq |
wc -l
>
Wow, that's a lot of methods!
I think the most elegant one was `w -h | wc -l`
I figured out yet another one:
who -q | grep \#
If you want only the number:
who -q | grep \# | sed 's/.*=//'
or:
u=`who -q | grep \#`; echo ${u/*=/}
_______________________________________________
|