Why can't I see the "wget" job when I execute it in the background?
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
.
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.
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.