This is the output:
[USER@SERVER ~] ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.024 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.030 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.026 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.026 ms
^Z
[1]+ Stopped ping localhost
[USER@SERVER ~] jobs
[1]+ Stopped ping localhost
[USER@SERVER ~] bg %1
[1]+ ping localhost &
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.034 ms
[USER@SERVER ~] 64 bytes from localhost (127.0.0.1): icmp_seq=7 ttl=64 time=0.030 ms
64 bytes from localhost (127.0.0.1): icmp_seq=8 ttl=64 time=0.032 ms
[USER@SERVER ~] ^C
[USER@SERVER ~] ^C
[USER@SERVER ~] 64 bytes from localhost (127.0.0.1): icmp_seq=9 ttl=64 time=0.031 ms
^C
[USER@SERVER ~] 64 bytes from localhost (127.0.0.1): icmp_seq=10 ttl=64 time=0.031 ms
64 bytes from localhost (127.0.0.1): icmp_seq=11 ttl=64 time=0.028 ms
ki64 bytes from localhost (127.0.0.1): icmp_seq=12 ttl=64 time=0.030 ms
ll %64 bytes from localhost (127.0.0.1): icmp_seq=13 ttl=64 time=0.031 ms
1
[1]+ Terminated ping localhost
[USER@SERVER ~]
of:
1) I start to ping localhost
2) CTRL+Z
3) bg %1
4) CTRL+C doesn't work.
5) I have to type "kill %1" to kill it..
What is the real-life use of the "bg" command? Where is it used in the real world?
$emacs file.txt
::blink blink $@#(&%#$@(%@$(%&@#::*$^Zbg
::aahhhh...:: – dmckee --- ex-moderator kitten Mar 06 '12 at 17:58kill %1
; if you prefer, you could typefg %1
to bring it back to the foreground, and then useCtrl+C
. (Not that there's much reason to prefer one over the other; both just send an "interrupt" signal.) – ruakh Mar 06 '12 at 19:27