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?
badblockswould 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,badblocksis 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:13killand ctrl+c. To be able to detach programs and re-attach them later look atscreenortmux. – Henrik supports the community Mar 04 '24 at 21:15reptyr– LogicalDeveloper Mar 04 '24 at 23:36screenortmux– Chris Davies Mar 05 '24 at 15:21