PDA

View Full Version : [all variants] How can I get a list of users running processes?



Underpants
February 23rd, 2010, 01:40 AM
I'm looking for a command that will give me a list of users (unique, dont name my user account 60 times) that are running processes on a system... Help?

tgalati4
February 23rd, 2010, 02:05 AM
w

FuturePilot
February 23rd, 2010, 02:07 AM
w

Edit: tgalati4 beat me to it

Baneblade
February 23rd, 2010, 02:15 AM
I think that is the best reply I have ever seen.

Its also the shortest, most concise and actually contained the solution to the OP's question... in one character! Haha.

Well done.

Underpants
February 23rd, 2010, 03:33 AM
Indeed. Very funny, except it's not what I asked for.



ps –fa | awk ‘{print NR “ ” $1}’ | sort -u

tgalati4
February 23rd, 2010, 05:07 AM
You can also use the negate switch with ps for some interesting results:

tgalati4@tpad-Gloria7 ~ $ ps -f -N -U tgalati4 -U root
UID PID PPID C STIME TTY TIME CMD
syslog 2257 1 0 Feb09 ? 00:00:03 /sbin/syslogd -u syslog
klog 2280 1 0 Feb09 ? 00:00:00 /sbin/klogd -P /var/run/klogd/km
108 2301 1 0 Feb09 ? 00:01:52 /bin/dbus-daemon --system
mail 2408 1 0 Feb09 ? 00:00:01 /usr/sbin/nullmailer-send -d
rwhod 2424 1 0 Feb09 ? 00:00:00 /usr/sbin/rwhod -b
rwhod 2430 2424 0 Feb09 ? 00:00:00 /usr/sbin/rwhod -b
111 2514 1 0 Feb09 ? 00:01:07 /usr/sbin/hald
111 2699 2581 0 Feb09 ? 00:00:00 hald-addon-acpi: listening on ac
avahi 2802 1 0 Feb09 ? 00:00:01 avahi-daemon: running [tpad-Glor
avahi 2808 2802 0 Feb09 ? 00:00:00 avahi-daemon: chroot helper
mail 7112 2408 0 20:04 ? 00:00:00 /usr/lib/nullmailer/smtp -