Which user is running the most processes?
My top
looks like this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6524 asjzdiwq 30 10 500m 41m 24m S 0.0 0.3 0:15.27 php-cgi
21274 asjzdiwq 30 10 500m 41m 24m S 0.0 0.3 0:04.97 php-cgi
9047 asjzdiwq 30 10 500m 40m 24m S 0.0 0.3 0:13.72 php-cgi
26918 asjzdiwq 30 10 499m 40m 24m S 0.0 0.3 0:12.87 php-cgi
13168 ahfvw0d1 30 10 498m 35m 20m S 0.0 0.2 0:03.49 php-cgi
8859 realnoni 30 10 495m 33m 20m S 0.0 0.2 0:11.27 php-cgi
6590 asjzdiwq 30 10 495m 32m 20m S 0.0 0.2 0:13.34 php-cgi
5657 holeyrai 30 10 495m 31m 19m S 0.0 0.2 0:04.47 php-cgi
14480 ripplecr 30 10 498m 31m 17m S 0.0 0.2 0:02.90 php-cgi
14442 ripplecr 30 10 497m 31m 17m S 0.0 0.2 0:02.00 php-cgi
10720 computer 30 10 496m 31m 18m S 0.0 0.2 0:08.75 php-cgi
23821 loghome 30 10 496m 31m 18m S 0.0 0.2 0:02.22 php-cgi
17623 devilsti 30 10 495m 31m 19m S 0.0 0.2 0:05.81 php-cgi
13305 realnoni 30 10 495m 30m 18m S 0.0 0.2 0:06.29 php-cgi
14461 ripplecr 30 10 496m 30m 17m S 0.0 0.2 0:01.47 php-cgi
8738 holeyrai 30 10 495m 30m 18m S 0.0 0.2 0:03.37 php-cgi
17569 devilsti 30 10 495m 30m 18m S 0.0 0.2 0:05.73 php-cgi
13174 ahfvw0d1 30 10 484m 30m 18m S 0.0 0.2 0:04.00 php-cgi
16126 realnoni 30 10 484m 30m 18m S 0.0 0.2 0:12.08 php-cgi
31561 a0w4pkbp 30 10 496m 30m 17m S 0.0 0.2 0:03.54 php-cgi
31565 ahfvw0d1 30 10 484m 29m 17m S 0.0 0.2 0:05.80 php-cgi
21275 asjzdiwq 30 10 484m 29m 18m S 0.0 0.2 0:01.77 php-cgi
You can see that the same "USER" can have multiple "COMMAND"s running as "php-cgi". I would like to find out which user is running the most processes and get a count of how many processes they are running.
process users top
bumped to the homepage by Community♦ 5 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
My top
looks like this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6524 asjzdiwq 30 10 500m 41m 24m S 0.0 0.3 0:15.27 php-cgi
21274 asjzdiwq 30 10 500m 41m 24m S 0.0 0.3 0:04.97 php-cgi
9047 asjzdiwq 30 10 500m 40m 24m S 0.0 0.3 0:13.72 php-cgi
26918 asjzdiwq 30 10 499m 40m 24m S 0.0 0.3 0:12.87 php-cgi
13168 ahfvw0d1 30 10 498m 35m 20m S 0.0 0.2 0:03.49 php-cgi
8859 realnoni 30 10 495m 33m 20m S 0.0 0.2 0:11.27 php-cgi
6590 asjzdiwq 30 10 495m 32m 20m S 0.0 0.2 0:13.34 php-cgi
5657 holeyrai 30 10 495m 31m 19m S 0.0 0.2 0:04.47 php-cgi
14480 ripplecr 30 10 498m 31m 17m S 0.0 0.2 0:02.90 php-cgi
14442 ripplecr 30 10 497m 31m 17m S 0.0 0.2 0:02.00 php-cgi
10720 computer 30 10 496m 31m 18m S 0.0 0.2 0:08.75 php-cgi
23821 loghome 30 10 496m 31m 18m S 0.0 0.2 0:02.22 php-cgi
17623 devilsti 30 10 495m 31m 19m S 0.0 0.2 0:05.81 php-cgi
13305 realnoni 30 10 495m 30m 18m S 0.0 0.2 0:06.29 php-cgi
14461 ripplecr 30 10 496m 30m 17m S 0.0 0.2 0:01.47 php-cgi
8738 holeyrai 30 10 495m 30m 18m S 0.0 0.2 0:03.37 php-cgi
17569 devilsti 30 10 495m 30m 18m S 0.0 0.2 0:05.73 php-cgi
13174 ahfvw0d1 30 10 484m 30m 18m S 0.0 0.2 0:04.00 php-cgi
16126 realnoni 30 10 484m 30m 18m S 0.0 0.2 0:12.08 php-cgi
31561 a0w4pkbp 30 10 496m 30m 17m S 0.0 0.2 0:03.54 php-cgi
31565 ahfvw0d1 30 10 484m 29m 17m S 0.0 0.2 0:05.80 php-cgi
21275 asjzdiwq 30 10 484m 29m 18m S 0.0 0.2 0:01.77 php-cgi
You can see that the same "USER" can have multiple "COMMAND"s running as "php-cgi". I would like to find out which user is running the most processes and get a count of how many processes they are running.
process users top
bumped to the homepage by Community♦ 5 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
My top
looks like this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6524 asjzdiwq 30 10 500m 41m 24m S 0.0 0.3 0:15.27 php-cgi
21274 asjzdiwq 30 10 500m 41m 24m S 0.0 0.3 0:04.97 php-cgi
9047 asjzdiwq 30 10 500m 40m 24m S 0.0 0.3 0:13.72 php-cgi
26918 asjzdiwq 30 10 499m 40m 24m S 0.0 0.3 0:12.87 php-cgi
13168 ahfvw0d1 30 10 498m 35m 20m S 0.0 0.2 0:03.49 php-cgi
8859 realnoni 30 10 495m 33m 20m S 0.0 0.2 0:11.27 php-cgi
6590 asjzdiwq 30 10 495m 32m 20m S 0.0 0.2 0:13.34 php-cgi
5657 holeyrai 30 10 495m 31m 19m S 0.0 0.2 0:04.47 php-cgi
14480 ripplecr 30 10 498m 31m 17m S 0.0 0.2 0:02.90 php-cgi
14442 ripplecr 30 10 497m 31m 17m S 0.0 0.2 0:02.00 php-cgi
10720 computer 30 10 496m 31m 18m S 0.0 0.2 0:08.75 php-cgi
23821 loghome 30 10 496m 31m 18m S 0.0 0.2 0:02.22 php-cgi
17623 devilsti 30 10 495m 31m 19m S 0.0 0.2 0:05.81 php-cgi
13305 realnoni 30 10 495m 30m 18m S 0.0 0.2 0:06.29 php-cgi
14461 ripplecr 30 10 496m 30m 17m S 0.0 0.2 0:01.47 php-cgi
8738 holeyrai 30 10 495m 30m 18m S 0.0 0.2 0:03.37 php-cgi
17569 devilsti 30 10 495m 30m 18m S 0.0 0.2 0:05.73 php-cgi
13174 ahfvw0d1 30 10 484m 30m 18m S 0.0 0.2 0:04.00 php-cgi
16126 realnoni 30 10 484m 30m 18m S 0.0 0.2 0:12.08 php-cgi
31561 a0w4pkbp 30 10 496m 30m 17m S 0.0 0.2 0:03.54 php-cgi
31565 ahfvw0d1 30 10 484m 29m 17m S 0.0 0.2 0:05.80 php-cgi
21275 asjzdiwq 30 10 484m 29m 18m S 0.0 0.2 0:01.77 php-cgi
You can see that the same "USER" can have multiple "COMMAND"s running as "php-cgi". I would like to find out which user is running the most processes and get a count of how many processes they are running.
process users top
My top
looks like this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6524 asjzdiwq 30 10 500m 41m 24m S 0.0 0.3 0:15.27 php-cgi
21274 asjzdiwq 30 10 500m 41m 24m S 0.0 0.3 0:04.97 php-cgi
9047 asjzdiwq 30 10 500m 40m 24m S 0.0 0.3 0:13.72 php-cgi
26918 asjzdiwq 30 10 499m 40m 24m S 0.0 0.3 0:12.87 php-cgi
13168 ahfvw0d1 30 10 498m 35m 20m S 0.0 0.2 0:03.49 php-cgi
8859 realnoni 30 10 495m 33m 20m S 0.0 0.2 0:11.27 php-cgi
6590 asjzdiwq 30 10 495m 32m 20m S 0.0 0.2 0:13.34 php-cgi
5657 holeyrai 30 10 495m 31m 19m S 0.0 0.2 0:04.47 php-cgi
14480 ripplecr 30 10 498m 31m 17m S 0.0 0.2 0:02.90 php-cgi
14442 ripplecr 30 10 497m 31m 17m S 0.0 0.2 0:02.00 php-cgi
10720 computer 30 10 496m 31m 18m S 0.0 0.2 0:08.75 php-cgi
23821 loghome 30 10 496m 31m 18m S 0.0 0.2 0:02.22 php-cgi
17623 devilsti 30 10 495m 31m 19m S 0.0 0.2 0:05.81 php-cgi
13305 realnoni 30 10 495m 30m 18m S 0.0 0.2 0:06.29 php-cgi
14461 ripplecr 30 10 496m 30m 17m S 0.0 0.2 0:01.47 php-cgi
8738 holeyrai 30 10 495m 30m 18m S 0.0 0.2 0:03.37 php-cgi
17569 devilsti 30 10 495m 30m 18m S 0.0 0.2 0:05.73 php-cgi
13174 ahfvw0d1 30 10 484m 30m 18m S 0.0 0.2 0:04.00 php-cgi
16126 realnoni 30 10 484m 30m 18m S 0.0 0.2 0:12.08 php-cgi
31561 a0w4pkbp 30 10 496m 30m 17m S 0.0 0.2 0:03.54 php-cgi
31565 ahfvw0d1 30 10 484m 29m 17m S 0.0 0.2 0:05.80 php-cgi
21275 asjzdiwq 30 10 484m 29m 18m S 0.0 0.2 0:01.77 php-cgi
You can see that the same "USER" can have multiple "COMMAND"s running as "php-cgi". I would like to find out which user is running the most processes and get a count of how many processes they are running.
process users top
process users top
edited Oct 8 '15 at 5:59
heemayl
34.8k373103
34.8k373103
asked Oct 8 '15 at 5:56
Dave KDave K
62
62
bumped to the homepage by Community♦ 5 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 5 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
To count all processes per user:
ps -eo user|sort|uniq -c|sort -n
or to just have the ones running php-cgi:
ps -eo user:15,cmd|sed -n '/php-cgi/s/ .*//p'|sort|uniq -c|sort -n
Thanks - the first command works well and displays the full usernames! The second command works correctly, but it displays most of the USERS with UID and not the full usernames.
– Dave K
Oct 8 '15 at 19:47
I think it is because your usernames are longer than the default width of the field. Try giving an explicit widthps -eo user:15,cmd|...
. I've edited this into my answer.
– meuh
Oct 8 '15 at 19:58
Setting it to 15 made most of the usernames appear, but 20 made them all appear - thanks!
– Dave K
Oct 8 '15 at 20:32
add a comment |
Use ps
. From man ps
:
-U userlist
Select by real user ID (RUID) or name.
It selects the processes whose real user name or ID is
in the userlist list. The real user ID identifies the
user who created the process, see getuid(2).
-u userlist
Select by effective user ID (EUID) or name.
This selects the processes whose effective user name or
ID is in userlist. The effective user ID describes the
user whose file access permissions are used by the
process (see geteuid(2)). Identical to U and --user.
So for example to see all processes of user asjzdiwq
, you can use:
ps -u asjzdiwq ## Using RUID
ps -U asjzdiwq ## Using EUID
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f234668%2fwhich-user-is-running-the-most-processes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To count all processes per user:
ps -eo user|sort|uniq -c|sort -n
or to just have the ones running php-cgi:
ps -eo user:15,cmd|sed -n '/php-cgi/s/ .*//p'|sort|uniq -c|sort -n
Thanks - the first command works well and displays the full usernames! The second command works correctly, but it displays most of the USERS with UID and not the full usernames.
– Dave K
Oct 8 '15 at 19:47
I think it is because your usernames are longer than the default width of the field. Try giving an explicit widthps -eo user:15,cmd|...
. I've edited this into my answer.
– meuh
Oct 8 '15 at 19:58
Setting it to 15 made most of the usernames appear, but 20 made them all appear - thanks!
– Dave K
Oct 8 '15 at 20:32
add a comment |
To count all processes per user:
ps -eo user|sort|uniq -c|sort -n
or to just have the ones running php-cgi:
ps -eo user:15,cmd|sed -n '/php-cgi/s/ .*//p'|sort|uniq -c|sort -n
Thanks - the first command works well and displays the full usernames! The second command works correctly, but it displays most of the USERS with UID and not the full usernames.
– Dave K
Oct 8 '15 at 19:47
I think it is because your usernames are longer than the default width of the field. Try giving an explicit widthps -eo user:15,cmd|...
. I've edited this into my answer.
– meuh
Oct 8 '15 at 19:58
Setting it to 15 made most of the usernames appear, but 20 made them all appear - thanks!
– Dave K
Oct 8 '15 at 20:32
add a comment |
To count all processes per user:
ps -eo user|sort|uniq -c|sort -n
or to just have the ones running php-cgi:
ps -eo user:15,cmd|sed -n '/php-cgi/s/ .*//p'|sort|uniq -c|sort -n
To count all processes per user:
ps -eo user|sort|uniq -c|sort -n
or to just have the ones running php-cgi:
ps -eo user:15,cmd|sed -n '/php-cgi/s/ .*//p'|sort|uniq -c|sort -n
edited Oct 8 '15 at 19:56
answered Oct 8 '15 at 6:42
meuhmeuh
31.8k11854
31.8k11854
Thanks - the first command works well and displays the full usernames! The second command works correctly, but it displays most of the USERS with UID and not the full usernames.
– Dave K
Oct 8 '15 at 19:47
I think it is because your usernames are longer than the default width of the field. Try giving an explicit widthps -eo user:15,cmd|...
. I've edited this into my answer.
– meuh
Oct 8 '15 at 19:58
Setting it to 15 made most of the usernames appear, but 20 made them all appear - thanks!
– Dave K
Oct 8 '15 at 20:32
add a comment |
Thanks - the first command works well and displays the full usernames! The second command works correctly, but it displays most of the USERS with UID and not the full usernames.
– Dave K
Oct 8 '15 at 19:47
I think it is because your usernames are longer than the default width of the field. Try giving an explicit widthps -eo user:15,cmd|...
. I've edited this into my answer.
– meuh
Oct 8 '15 at 19:58
Setting it to 15 made most of the usernames appear, but 20 made them all appear - thanks!
– Dave K
Oct 8 '15 at 20:32
Thanks - the first command works well and displays the full usernames! The second command works correctly, but it displays most of the USERS with UID and not the full usernames.
– Dave K
Oct 8 '15 at 19:47
Thanks - the first command works well and displays the full usernames! The second command works correctly, but it displays most of the USERS with UID and not the full usernames.
– Dave K
Oct 8 '15 at 19:47
I think it is because your usernames are longer than the default width of the field. Try giving an explicit width
ps -eo user:15,cmd|...
. I've edited this into my answer.– meuh
Oct 8 '15 at 19:58
I think it is because your usernames are longer than the default width of the field. Try giving an explicit width
ps -eo user:15,cmd|...
. I've edited this into my answer.– meuh
Oct 8 '15 at 19:58
Setting it to 15 made most of the usernames appear, but 20 made them all appear - thanks!
– Dave K
Oct 8 '15 at 20:32
Setting it to 15 made most of the usernames appear, but 20 made them all appear - thanks!
– Dave K
Oct 8 '15 at 20:32
add a comment |
Use ps
. From man ps
:
-U userlist
Select by real user ID (RUID) or name.
It selects the processes whose real user name or ID is
in the userlist list. The real user ID identifies the
user who created the process, see getuid(2).
-u userlist
Select by effective user ID (EUID) or name.
This selects the processes whose effective user name or
ID is in userlist. The effective user ID describes the
user whose file access permissions are used by the
process (see geteuid(2)). Identical to U and --user.
So for example to see all processes of user asjzdiwq
, you can use:
ps -u asjzdiwq ## Using RUID
ps -U asjzdiwq ## Using EUID
add a comment |
Use ps
. From man ps
:
-U userlist
Select by real user ID (RUID) or name.
It selects the processes whose real user name or ID is
in the userlist list. The real user ID identifies the
user who created the process, see getuid(2).
-u userlist
Select by effective user ID (EUID) or name.
This selects the processes whose effective user name or
ID is in userlist. The effective user ID describes the
user whose file access permissions are used by the
process (see geteuid(2)). Identical to U and --user.
So for example to see all processes of user asjzdiwq
, you can use:
ps -u asjzdiwq ## Using RUID
ps -U asjzdiwq ## Using EUID
add a comment |
Use ps
. From man ps
:
-U userlist
Select by real user ID (RUID) or name.
It selects the processes whose real user name or ID is
in the userlist list. The real user ID identifies the
user who created the process, see getuid(2).
-u userlist
Select by effective user ID (EUID) or name.
This selects the processes whose effective user name or
ID is in userlist. The effective user ID describes the
user whose file access permissions are used by the
process (see geteuid(2)). Identical to U and --user.
So for example to see all processes of user asjzdiwq
, you can use:
ps -u asjzdiwq ## Using RUID
ps -U asjzdiwq ## Using EUID
Use ps
. From man ps
:
-U userlist
Select by real user ID (RUID) or name.
It selects the processes whose real user name or ID is
in the userlist list. The real user ID identifies the
user who created the process, see getuid(2).
-u userlist
Select by effective user ID (EUID) or name.
This selects the processes whose effective user name or
ID is in userlist. The effective user ID describes the
user whose file access permissions are used by the
process (see geteuid(2)). Identical to U and --user.
So for example to see all processes of user asjzdiwq
, you can use:
ps -u asjzdiwq ## Using RUID
ps -U asjzdiwq ## Using EUID
answered Oct 8 '15 at 6:02
heemaylheemayl
34.8k373103
34.8k373103
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f234668%2fwhich-user-is-running-the-most-processes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown