For me, uptime
yields 9 users, but
ps -Af | cut -f1 -d' ' | sort | uniq | wc -l
yields 14.
I'm not exactly sure where the 9 is coming from.
Before I jump to conclusions though, please let me know if you guys do not have such a discrepancy.
uptime
For me, uptime
yields 9 users, but
ps -Af | cut -f1 -d' ' | sort | uniq | wc -l
yields 14.
I'm not exactly sure where the 9 is coming from.
Before I jump to conclusions though, please let me know if you guys do not have such a discrepancy.
Best Answer
You're comparing apples and oranges.
ps
will list the processes running. You're then getting the count of unique process-owning user ids.uptime
will report the users logged on. By using utmp. More details at https://github.com/coreutils/coreutils/blob/master/src/uptime.c#L177So, comparison of output, highlighting this, below.