LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   put task in backgrond with keystroke (https://www.linuxquestions.org/questions/linux-general-1/put-task-in-backgrond-with-keystroke-12927/)

febisfebi 01-28-2002 07:02 PM

put task in backgrond with keystroke
 
i have been using a motion of ctrl-z, followed by bg, to put tasks in the background. this can be inneficient, and dosent work for some tasks that cant be stopped or they mess up, example: a download. if anyone knows a ctrl-something, or how to set one up to put a task directly in the backround, and avoid stopping it i would greatly appreciate it.

neo77777 01-28-2002 07:36 PM

You can append '&' after the command name it will put the task on background but you'll get all the warnings and errors that the task you are running may throw in your face, so you can redirect the output of it to a file or /dev/null if it's not imporatnt to you. To redirect error channel use as this
[shell]$ command > to_file.txt 2>&1 &

febisfebi 01-28-2002 08:05 PM

i know you can just put an & after it, but i am talking about a prog, that i use for a while, and then put in the background, so i can logout or get it out of the way while its doing whatever. ctrl-z and bg does exactly what i want, but it stops the task, i am looking for a ctrl-something to do the same thing as ctrl-z, except put it in the background, instead of stopping it.

neo77777 01-28-2002 10:24 PM

sorry man, I don't have a clue, I understand what you are talking about, and unfortunately there is no answer from me; I've looked over all my UNIX books and I couldn't find it.

ryanstrayer 01-28-2002 10:35 PM

Try using the 'disown" command - that might be what your looking for.

List your processes then type ' disown 123 ' ... 123 being your process ID.

febisfebi 01-29-2002 12:45 AM

that is actually something i didnt know and may be useful, but what i was looking for was a ctrl-something, so you could just do it to the running task. There must be a way to do this, as there is one of these for just about everythign else. ie. ctrl-z - stop, ctrl-c - stop, etc.etc.etc...

ryanstrayer 01-29-2002 01:29 AM

Hmm you must be using some window manager I don't know about - never heard of what you're trying to do either.. ;)

febisfebi 01-29-2002 01:30 AM

i am thinking of mainly console applications

hanzerik 01-29-2002 07:58 AM

use screen.
this is what i use for setiathome:
screen /home/hanzerik/setiathome . After I type that i can close my ssh connection and it will stay running. To switch back to that program use screen -r .

febisfebi 01-29-2002 05:20 PM

Quote:

Originally posted by hanzerik
use screen.
this is what i use for setiathome:
screen /home/hanzerik/setiathome . After I type that i can close my ssh connection and it will stay running. To switch back to that program use screen -r .

what about if i am using an app for a while, and then want to put it in the background, thats why i mention the ctrl-something

ryanstrayer 01-29-2002 05:22 PM

Why don't you just leave it up - and switch consoles? That's what I do.. if I'm running something and I want to leave it up, but do other stuff - I'll just switch to tty2 or whatever... that's essentially the best way locally... screen as mentioned above, also works very well, esspecially if you want to resume a session of something from a SSH console or something.

febisfebi 01-29-2002 06:17 PM

i would be using this mainly remotely. there is a ctrl-z to stop a proccess, what i need to know is if there is a ctrl-something to put it in the background.


All times are GMT -5. The time now is 11:17 PM.