What is Nostr?
mos_8502 :verified: /
npub1qnu…hzwk
2024-08-29 19:45:54

mos_8502 :verified: on Nostr: Job control at the shell: Run a command that keeps running. For these purposes, the ...

Job control at the shell:

Run a command that keeps running. For these purposes, the otherwise pointless command:<code>ping localhost &gt; /dev/null<br></code>

Nothing much will happen, though the program is running normally. It just doesn't spit out any output, or, rather, spits it out into the null device, where it gets eaten. So pretend this is doing something useful.

Now we want to run something else. We don't need to kill this task, nor do we need to open a new terminal or swap virtual consoles. We don't need screen or tmux for this either.

Just hit Control+Z. You will get something like: <code>[1]+ Stopped ping localhost &gt; /dev/null<br></code>

and the shell prompt will be back. That task is now "stopped" which means it's basically paused -- still running, but suspended.

The [1] is the *job number* -- and you can refer to the job by that id with the bg and fg commands by prefixing it with %.

Run this:<code>bg %1<br></code>

and you will get the output<code>[1]+ ping localhost &gt; /dev/null &amp;<br></code>

This tells you than job 1 is running again, now in the background, exactly as if you had run it with &amp; at the end. Now, if you want to bring it back to the foreground, you can just do this:<code>fg %1<br></code>

and it will bring it up front and centre. If, instead, you want to terminate the job, you can do<code>kill %1<br></code>

and that'll do it for you.
Author Public Key
npub1qnufz4pycufk27kkeev5g0fgm0w0tqexsly674s2uwy0tynk5ymsk5hzwk