Why can't I see the “wget” job when I execute it in the background?












8















I use wget command in the background like this



wget -bq


and it prints




Continuing in background, pid 31754.




But when I type the command jobs, I don't see my job(although the downloading is not finished).










share|improve this question




















  • 2





    You can see it with ps -p 31754

    – RoVo
    Jan 11 at 13:24













  • Jjobs only works for the (this) shell job control (namely & annotation, ctrl-z or bg commamd). General process listing (ps -a will show it)

    – eckes
    Jan 11 at 19:23
















8















I use wget command in the background like this



wget -bq


and it prints




Continuing in background, pid 31754.




But when I type the command jobs, I don't see my job(although the downloading is not finished).










share|improve this question




















  • 2





    You can see it with ps -p 31754

    – RoVo
    Jan 11 at 13:24













  • Jjobs only works for the (this) shell job control (namely & annotation, ctrl-z or bg commamd). General process listing (ps -a will show it)

    – eckes
    Jan 11 at 19:23














8












8








8


1






I use wget command in the background like this



wget -bq


and it prints




Continuing in background, pid 31754.




But when I type the command jobs, I don't see my job(although the downloading is not finished).










share|improve this question
















I use wget command in the background like this



wget -bq


and it prints




Continuing in background, pid 31754.




But when I type the command jobs, I don't see my job(although the downloading is not finished).







command-line wget background-process job-control






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 11 at 13:30









Kusalananda

127k16239393




127k16239393










asked Jan 11 at 13:08









floydfloyd

1433




1433








  • 2





    You can see it with ps -p 31754

    – RoVo
    Jan 11 at 13:24













  • Jjobs only works for the (this) shell job control (namely & annotation, ctrl-z or bg commamd). General process listing (ps -a will show it)

    – eckes
    Jan 11 at 19:23














  • 2





    You can see it with ps -p 31754

    – RoVo
    Jan 11 at 13:24













  • Jjobs only works for the (this) shell job control (namely & annotation, ctrl-z or bg commamd). General process listing (ps -a will show it)

    – eckes
    Jan 11 at 19:23








2




2





You can see it with ps -p 31754

– RoVo
Jan 11 at 13:24







You can see it with ps -p 31754

– RoVo
Jan 11 at 13:24















Jjobs only works for the (this) shell job control (namely & annotation, ctrl-z or bg commamd). General process listing (ps -a will show it)

– eckes
Jan 11 at 19:23





Jjobs only works for the (this) shell job control (namely & annotation, ctrl-z or bg commamd). General process listing (ps -a will show it)

– eckes
Jan 11 at 19:23










3 Answers
3






active

oldest

votes


















19














When using wget with -b or --background it puts itself into the background by disassociating from the current shell (by forking off a child process and terminating the parent). Since it's not the shell that puts it in the background as an asynchronous job, it will not show up as a job when you use jobs.



To run wget as an asynchronous (background) job in the shell, use



wget ... URL &


If you do this, you may additionally want to redirect output to some file (which wget does automatically with -b), or discard it by redirecting to /dev/null, or use -q or --quiet.






share|improve this answer





















  • 1





    it forks a child and the parent exits

    – user2497
    Jan 11 at 13:42











  • @user2497 Yes, see updated answer.

    – Kusalananda
    Jan 11 at 15:28



















6














Because it put it self in the background. Use & to tell bash to put it into background, and to put it into bash's list of jobs.



Background and job control list are not the same. Bash puts all of its background processes into its jobs control list (by default), but processes can be backgrounded with out being put in the list. Only bash can put jobs in its list.



There may be advantages to the -bg option (I don't know what). For example ssh's background option, puts it into the background after asking for a password.






share|improve this answer



















  • 3





    It's -bq, i.e. -b and -q, not -bg.

    – Kusalananda
    Jan 11 at 13:25



















2














The process with pid 31754 exists; if you type ps -e |grep 31754 but as it is not a job that can be moved to the foreground again, it is not displayed by the jobs command. wget -bq automatically send the output to the background without options to move it to the foreground again.






share|improve this answer
























  • ps has a -p option that can be used to query a specific PID, or one may use pgrep wget.

    – Kusalananda
    Jan 11 at 13:28











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493943%2fwhy-cant-i-see-the-wget-job-when-i-execute-it-in-the-background%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









19














When using wget with -b or --background it puts itself into the background by disassociating from the current shell (by forking off a child process and terminating the parent). Since it's not the shell that puts it in the background as an asynchronous job, it will not show up as a job when you use jobs.



To run wget as an asynchronous (background) job in the shell, use



wget ... URL &


If you do this, you may additionally want to redirect output to some file (which wget does automatically with -b), or discard it by redirecting to /dev/null, or use -q or --quiet.






share|improve this answer





















  • 1





    it forks a child and the parent exits

    – user2497
    Jan 11 at 13:42











  • @user2497 Yes, see updated answer.

    – Kusalananda
    Jan 11 at 15:28
















19














When using wget with -b or --background it puts itself into the background by disassociating from the current shell (by forking off a child process and terminating the parent). Since it's not the shell that puts it in the background as an asynchronous job, it will not show up as a job when you use jobs.



To run wget as an asynchronous (background) job in the shell, use



wget ... URL &


If you do this, you may additionally want to redirect output to some file (which wget does automatically with -b), or discard it by redirecting to /dev/null, or use -q or --quiet.






share|improve this answer





















  • 1





    it forks a child and the parent exits

    – user2497
    Jan 11 at 13:42











  • @user2497 Yes, see updated answer.

    – Kusalananda
    Jan 11 at 15:28














19












19








19







When using wget with -b or --background it puts itself into the background by disassociating from the current shell (by forking off a child process and terminating the parent). Since it's not the shell that puts it in the background as an asynchronous job, it will not show up as a job when you use jobs.



To run wget as an asynchronous (background) job in the shell, use



wget ... URL &


If you do this, you may additionally want to redirect output to some file (which wget does automatically with -b), or discard it by redirecting to /dev/null, or use -q or --quiet.






share|improve this answer















When using wget with -b or --background it puts itself into the background by disassociating from the current shell (by forking off a child process and terminating the parent). Since it's not the shell that puts it in the background as an asynchronous job, it will not show up as a job when you use jobs.



To run wget as an asynchronous (background) job in the shell, use



wget ... URL &


If you do this, you may additionally want to redirect output to some file (which wget does automatically with -b), or discard it by redirecting to /dev/null, or use -q or --quiet.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 12 at 8:09

























answered Jan 11 at 13:20









KusalanandaKusalananda

127k16239393




127k16239393








  • 1





    it forks a child and the parent exits

    – user2497
    Jan 11 at 13:42











  • @user2497 Yes, see updated answer.

    – Kusalananda
    Jan 11 at 15:28














  • 1





    it forks a child and the parent exits

    – user2497
    Jan 11 at 13:42











  • @user2497 Yes, see updated answer.

    – Kusalananda
    Jan 11 at 15:28








1




1





it forks a child and the parent exits

– user2497
Jan 11 at 13:42





it forks a child and the parent exits

– user2497
Jan 11 at 13:42













@user2497 Yes, see updated answer.

– Kusalananda
Jan 11 at 15:28





@user2497 Yes, see updated answer.

– Kusalananda
Jan 11 at 15:28













6














Because it put it self in the background. Use & to tell bash to put it into background, and to put it into bash's list of jobs.



Background and job control list are not the same. Bash puts all of its background processes into its jobs control list (by default), but processes can be backgrounded with out being put in the list. Only bash can put jobs in its list.



There may be advantages to the -bg option (I don't know what). For example ssh's background option, puts it into the background after asking for a password.






share|improve this answer



















  • 3





    It's -bq, i.e. -b and -q, not -bg.

    – Kusalananda
    Jan 11 at 13:25
















6














Because it put it self in the background. Use & to tell bash to put it into background, and to put it into bash's list of jobs.



Background and job control list are not the same. Bash puts all of its background processes into its jobs control list (by default), but processes can be backgrounded with out being put in the list. Only bash can put jobs in its list.



There may be advantages to the -bg option (I don't know what). For example ssh's background option, puts it into the background after asking for a password.






share|improve this answer



















  • 3





    It's -bq, i.e. -b and -q, not -bg.

    – Kusalananda
    Jan 11 at 13:25














6












6








6







Because it put it self in the background. Use & to tell bash to put it into background, and to put it into bash's list of jobs.



Background and job control list are not the same. Bash puts all of its background processes into its jobs control list (by default), but processes can be backgrounded with out being put in the list. Only bash can put jobs in its list.



There may be advantages to the -bg option (I don't know what). For example ssh's background option, puts it into the background after asking for a password.






share|improve this answer













Because it put it self in the background. Use & to tell bash to put it into background, and to put it into bash's list of jobs.



Background and job control list are not the same. Bash puts all of its background processes into its jobs control list (by default), but processes can be backgrounded with out being put in the list. Only bash can put jobs in its list.



There may be advantages to the -bg option (I don't know what). For example ssh's background option, puts it into the background after asking for a password.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 11 at 13:20









ctrl-alt-delorctrl-alt-delor

11.2k42058




11.2k42058








  • 3





    It's -bq, i.e. -b and -q, not -bg.

    – Kusalananda
    Jan 11 at 13:25














  • 3





    It's -bq, i.e. -b and -q, not -bg.

    – Kusalananda
    Jan 11 at 13:25








3




3





It's -bq, i.e. -b and -q, not -bg.

– Kusalananda
Jan 11 at 13:25





It's -bq, i.e. -b and -q, not -bg.

– Kusalananda
Jan 11 at 13:25











2














The process with pid 31754 exists; if you type ps -e |grep 31754 but as it is not a job that can be moved to the foreground again, it is not displayed by the jobs command. wget -bq automatically send the output to the background without options to move it to the foreground again.






share|improve this answer
























  • ps has a -p option that can be used to query a specific PID, or one may use pgrep wget.

    – Kusalananda
    Jan 11 at 13:28
















2














The process with pid 31754 exists; if you type ps -e |grep 31754 but as it is not a job that can be moved to the foreground again, it is not displayed by the jobs command. wget -bq automatically send the output to the background without options to move it to the foreground again.






share|improve this answer
























  • ps has a -p option that can be used to query a specific PID, or one may use pgrep wget.

    – Kusalananda
    Jan 11 at 13:28














2












2








2







The process with pid 31754 exists; if you type ps -e |grep 31754 but as it is not a job that can be moved to the foreground again, it is not displayed by the jobs command. wget -bq automatically send the output to the background without options to move it to the foreground again.






share|improve this answer













The process with pid 31754 exists; if you type ps -e |grep 31754 but as it is not a job that can be moved to the foreground again, it is not displayed by the jobs command. wget -bq automatically send the output to the background without options to move it to the foreground again.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 11 at 13:27









DaselDasel

4497




4497













  • ps has a -p option that can be used to query a specific PID, or one may use pgrep wget.

    – Kusalananda
    Jan 11 at 13:28



















  • ps has a -p option that can be used to query a specific PID, or one may use pgrep wget.

    – Kusalananda
    Jan 11 at 13:28

















ps has a -p option that can be used to query a specific PID, or one may use pgrep wget.

– Kusalananda
Jan 11 at 13:28





ps has a -p option that can be used to query a specific PID, or one may use pgrep wget.

– Kusalananda
Jan 11 at 13:28


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493943%2fwhy-cant-i-see-the-wget-job-when-i-execute-it-in-the-background%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

張江高科駅