kill background vs normal process in unix [closed] - bash

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I know how to kill a currently running foreground process, e.g.
$kill 15916
What I don't know is what is different about killing a background process.
What's different about killing a background process?

Nothing is different about killing a background task. If you have the process id you can send it a signal (including a terminate or interrupt, as you're doing above)
I'm not sure about your definitions of foreground/background, though. Foreground is the process running in your shell, and your shell is waiting for it to finish before returning control to you. A background task is one that's been disconnected from the shell's input/output. Note that from the process' point of view, it doesn't really have a concept of foreground/background. That's really from the shell's point of view.

Related

How can I open a program on second monitor using PowerShell? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I am going to run a script in cmd on a multi-monitor (multi-screen) computer with two monitors. In this script, I will call and run another program. One of these monitors is located in another room. (Let us call it monitor number 0). These two screens are in extended mode. Extending monitors means that your computer interprets the monitors that you are extending as separate devices. You can see different things on each monitor, and your desktop background is displayed on each monitor.
The problem is that this program will show on the monitor number 0 (which I cannot see the results). In fact, I want to see the output on my own screen.
So, the question is that why everything shows on monitor number 0 and how I can tell to powershell/cmd to show the result on monitor number 1.
Maybe, you can find your answer here.

How to Exit An App in Terminal While Leaving it Running in Background [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I learned how do to do this in my Linux class last year, but can't for the life of me remember how to do it. I've google searched probably about 30 different combinations of words to try to find out how, but nothing is turning up the correct search.
I'm trying to recall how to close an application (Like pico or emacs) and leave it running in the background.
Additionally, it might be nice to know how to pick that app back up where I left off, which I never learned. Any help would be much appreciated.
When using Bash and some other shells, you can use Ctrl+Z suspend a program then run "fg" to bring it back to the foreground. If you want the program to continue running in the background, typing "bg" will resume the process. If the process prints any output while it's in the background, your display will probably end up being mangled.
For simple commands, instead running your application directly, call it using nohup like this:
nohup ./myScript.sh &
Or alternatively for something like complex like emacs, you can use screen.

Find the owner shell for a process [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
How can I find a process is owned by which shell?
It is useful as I have a server with multiple logged in users and a few long-running processes, and I want to know which users can I force log-out without stopping their started jobs.
The output of ps is reporting a TTY, but it is not useful as even after disowning a job, its TTY remains the same. So how can I find out if a user disown/nohuped its started processes?
You can't find the “owner shell” in the sense you're describing, because there's no such thing. You can find the parent process, which may be a shell; but you can't know whether the shell disowned the job, because that operation is purely internal to the shell.
What you should really do is instruct your users to start long-running programs inside Screen or Tmux. These are somewhat complex programs, but for basic use, they are very simple.
Start a Screen session by running the command screen.
You can run commands inside that session, and they'll keep running even if you log out.
If you want to log out with a command still running, disconnect from the Screen session by typing Ctrl+A D.
To reconnect to an existing Screen session, run screen -rd.
If you exit the shell inside a Screen session, the session exits.
You could perhaps make a wrapper script around long-running processes that starts screen automatically.

Detach running programe from bash [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm often in the situation that I run a linux task but then I have to leave the computer or shutdown the notebook, and the task I ran from putty has not finished yet.
Is there a way of I can quit putty and leave the process running 'til it's finished?
I know I can use screen etc, but now I already started the command w/o screen.
(please don't bother too much I didnt directly ask on superuser, serverfault or unix SO.)
Press Ctrl-Z to put the command to background.
Run bg to run it from being suspended.
Then run disown to disown the process from the parent.
It actually also depends on how your command works. Some command exits when it loses its terminal. If that's the case, you can really only just run it with screen or use nohup command </dev/null >/dev/null 2>&1 &.
One way to run it with screen could be screen -dm command.

Can I stop applications from grabbing focus in OS X? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
Applications stealing focus is on of my biggest UI pet peeves. There's rarely a good reason for an application that I'm not using to interrupt what I'm doing.
Is there a way to disable focus-grabbing globally in OS X?
The only time I've ever seen "focus stealing" was when I was launching a bunch of applications at once, but didn't want them to gain focus. I do this when I start work in the morning; I have a script that launches about 5 or 6 apps I always use.
If this is your specific case, the behavior can be suppressed in apple script.

Resources