I executed a command which I then disowned so that it can continue to run in the background, even if I closed the terminal.
The command is:
badblocks -v -s -w /dev/sdb > badblocks_result.txt 2>&1 & disown
The command is running with a PID of 1146
.
How do I bring that back into the current terminal that I am using if I would like to CTRL-C the command and not kill it using the PID?
badblocks
would get SIGINT just like fromkill -s INT 1146
, it couldn't tell the difference. In general Ctrl+c sends SIGINT to a process group, so if you target just one process withkill -s INT
, something may misbehave (example); but here there should be no issues,badblocks
is most likely the only process in its process group. Why do you want Ctrl+c and notkill
? If you really want:reptyr
. – Kamil Maciorowski Mar 04 '24 at 20:13kill
and ctrl+c. To be able to detach programs and re-attach them later look atscreen
ortmux
. – Henrik supports the community Mar 04 '24 at 21:15reptyr
– LogicalDeveloper Mar 04 '24 at 23:36screen
ortmux
– Chris Davies Mar 05 '24 at 15:21