Linux command that spawns multiple processes
I am looking for a linux command (like ls
, time
or anything similar) that spawns multiple processes. Anything which is to be run from a command line and not a shell script.
The reason is I want to see parent-child relationship on the htop
and with different Process IDs.
Thanks
command-line process
New contributor
add a comment |
I am looking for a linux command (like ls
, time
or anything similar) that spawns multiple processes. Anything which is to be run from a command line and not a shell script.
The reason is I want to see parent-child relationship on the htop
and with different Process IDs.
Thanks
command-line process
New contributor
3
It might be easier to write a program than to use an existing command. After all, commands exist to do something, and you might not want that something to be done. You could easily write a program that spawns processes that do something like compute the first N primes, taking up processor cycles but having no other effect on your system.
– jamesqf
yesterday
Woulddig
do?
– kasperd
15 hours ago
add a comment |
I am looking for a linux command (like ls
, time
or anything similar) that spawns multiple processes. Anything which is to be run from a command line and not a shell script.
The reason is I want to see parent-child relationship on the htop
and with different Process IDs.
Thanks
command-line process
New contributor
I am looking for a linux command (like ls
, time
or anything similar) that spawns multiple processes. Anything which is to be run from a command line and not a shell script.
The reason is I want to see parent-child relationship on the htop
and with different Process IDs.
Thanks
command-line process
command-line process
New contributor
New contributor
New contributor
asked yesterday
talekeDskobeDatalekeDskobeDa
191
191
New contributor
New contributor
3
It might be easier to write a program than to use an existing command. After all, commands exist to do something, and you might not want that something to be done. You could easily write a program that spawns processes that do something like compute the first N primes, taking up processor cycles but having no other effect on your system.
– jamesqf
yesterday
Woulddig
do?
– kasperd
15 hours ago
add a comment |
3
It might be easier to write a program than to use an existing command. After all, commands exist to do something, and you might not want that something to be done. You could easily write a program that spawns processes that do something like compute the first N primes, taking up processor cycles but having no other effect on your system.
– jamesqf
yesterday
Woulddig
do?
– kasperd
15 hours ago
3
3
It might be easier to write a program than to use an existing command. After all, commands exist to do something, and you might not want that something to be done. You could easily write a program that spawns processes that do something like compute the first N primes, taking up processor cycles but having no other effect on your system.
– jamesqf
yesterday
It might be easier to write a program than to use an existing command. After all, commands exist to do something, and you might not want that something to be done. You could easily write a program that spawns processes that do something like compute the first N primes, taking up processor cycles but having no other effect on your system.
– jamesqf
yesterday
Would
dig
do?– kasperd
15 hours ago
Would
dig
do?– kasperd
15 hours ago
add a comment |
2 Answers
2
active
oldest
votes
The &
command separator will do this for you. Use it carefully and wisely, but here is a simple way to see process relationships:
$ sleep 5 & pstree -p $$
[1] 13369
bash(13337)─┬─pstree(13370)
└─sleep(13369)
The [1] 13369
shows that sleep
(which has PID 13369), has been put into the background as Job #1. $$
returns to the shell the PID of itself, so we feed that into pstree
to show the process tree with a root of our shell's PID, to show all child processes.
add a comment |
If you don't want to have any shells in the mix, you can simply use one of the "wrapper" programs that spawn another program to do something with it:
/bin/time sleep 60
watch sleep 1
(this one will keep respawningsleep
)
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
});
}
});
talekeDskobeDa is a new contributor. Be nice, and check out our Code of Conduct.
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%2f498162%2flinux-command-that-spawns-multiple-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
The &
command separator will do this for you. Use it carefully and wisely, but here is a simple way to see process relationships:
$ sleep 5 & pstree -p $$
[1] 13369
bash(13337)─┬─pstree(13370)
└─sleep(13369)
The [1] 13369
shows that sleep
(which has PID 13369), has been put into the background as Job #1. $$
returns to the shell the PID of itself, so we feed that into pstree
to show the process tree with a root of our shell's PID, to show all child processes.
add a comment |
The &
command separator will do this for you. Use it carefully and wisely, but here is a simple way to see process relationships:
$ sleep 5 & pstree -p $$
[1] 13369
bash(13337)─┬─pstree(13370)
└─sleep(13369)
The [1] 13369
shows that sleep
(which has PID 13369), has been put into the background as Job #1. $$
returns to the shell the PID of itself, so we feed that into pstree
to show the process tree with a root of our shell's PID, to show all child processes.
add a comment |
The &
command separator will do this for you. Use it carefully and wisely, but here is a simple way to see process relationships:
$ sleep 5 & pstree -p $$
[1] 13369
bash(13337)─┬─pstree(13370)
└─sleep(13369)
The [1] 13369
shows that sleep
(which has PID 13369), has been put into the background as Job #1. $$
returns to the shell the PID of itself, so we feed that into pstree
to show the process tree with a root of our shell's PID, to show all child processes.
The &
command separator will do this for you. Use it carefully and wisely, but here is a simple way to see process relationships:
$ sleep 5 & pstree -p $$
[1] 13369
bash(13337)─┬─pstree(13370)
└─sleep(13369)
The [1] 13369
shows that sleep
(which has PID 13369), has been put into the background as Job #1. $$
returns to the shell the PID of itself, so we feed that into pstree
to show the process tree with a root of our shell's PID, to show all child processes.
answered yesterday
DopeGhotiDopeGhoti
45.1k55988
45.1k55988
add a comment |
add a comment |
If you don't want to have any shells in the mix, you can simply use one of the "wrapper" programs that spawn another program to do something with it:
/bin/time sleep 60
watch sleep 1
(this one will keep respawningsleep
)
add a comment |
If you don't want to have any shells in the mix, you can simply use one of the "wrapper" programs that spawn another program to do something with it:
/bin/time sleep 60
watch sleep 1
(this one will keep respawningsleep
)
add a comment |
If you don't want to have any shells in the mix, you can simply use one of the "wrapper" programs that spawn another program to do something with it:
/bin/time sleep 60
watch sleep 1
(this one will keep respawningsleep
)
If you don't want to have any shells in the mix, you can simply use one of the "wrapper" programs that spawn another program to do something with it:
/bin/time sleep 60
watch sleep 1
(this one will keep respawningsleep
)
answered yesterday
TooTeaTooTea
659110
659110
add a comment |
add a comment |
talekeDskobeDa is a new contributor. Be nice, and check out our Code of Conduct.
talekeDskobeDa is a new contributor. Be nice, and check out our Code of Conduct.
talekeDskobeDa is a new contributor. Be nice, and check out our Code of Conduct.
talekeDskobeDa is a new contributor. Be nice, and check out our Code of Conduct.
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%2f498162%2flinux-command-that-spawns-multiple-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
3
It might be easier to write a program than to use an existing command. After all, commands exist to do something, and you might not want that something to be done. You could easily write a program that spawns processes that do something like compute the first N primes, taking up processor cycles but having no other effect on your system.
– jamesqf
yesterday
Would
dig
do?– kasperd
15 hours ago