From the course: Linux Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Process management: fg, bg, and kill

Process management: fg, bg, and kill - Linux Tutorial

From the course: Linux Tips

Process management: fg, bg, and kill

- [Instructor] While there are tools to allow us to multitask at the command line, such as tmux and screen. In Bash and some other shells, we can do something similar with job control. Jobs, or tasks that we start at the command line, can be sent to run in the background so they're not blocking the interface. They can be brought back into the foreground if interaction is needed. Let's make a little Bash script here to use for our purposes. This script will run forever and every 30 seconds it will read a message with its own process ID to the system log. I'll save this and close the editor. Now let's take a look at the script running. Pretty boring, but the point here is the program is running and we can't do anything else at the command line until it exits. I'll stop this with Control+C and we're back at the command line. Okay, but that program isn't running anymore. If we wanted to keep it running while we're using this terminal session, we could open the program and put an ampersand…

Contents