[H-GEN] Foregrounding a task

Ben Fowler bjf at bjf.id.au
Mon Apr 24 07:09:41 EDT 2006


Rick Phillips wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug and     ]
> [ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
>
> Hi Geoff,
>
>   
>> I rather expect I already know the answer to this but...
>>
>> I was running a process on a remote machine when my host went down.  The 
>> process on the remote box still shows as running, but I can't see any way 
>> of foregrounding it so I can save my work.  Experimenting with signals 
>> using another instance of the program merely results in either exits or 
>> suspends, but maybe there's a signal that I should try that I haven't (I've 
>> tried CONT).
>>     
>
> Try running the bash command "fg".  That should foreground any job
> running in background.
>
> Good Luck!
>
> Rick Phillips
>   

The bash(1) manpage will have more detail, but it's worth mentioning 
'fg' can be used on more than one background task.

Use 'jobs' to get a list of child processes running under the shell.  
It'll list their names and a number, e.g. [1] grep or whatever.

That number is useful because you can do stuff like 'kill %1', 'kill %2' 
to kill a child process, or use 'fg 1', 'fg 2', etc to foreground a 
particular job.

I personally tend to use screen(1) or multiple terminal windows, but the 
above is still useful.

Regards,

Ben.

P.S. I can name at least half a dozen HUMBUGgers who swear by screen(1). 
It can do loads of stuff, like having multiple shells in one window, 
split screen, keyboard locking and loads of other things.  It really 
comes into its own when you're on a dumbterm or something similar -- 
it's like Linux virtual terminals, but even more useful.






More information about the General mailing list