HomeОбразованиеRelated VideosMore From: theurbanpenguin

Managing foreground and background processes

116 ratings | 17975 views
More videos like this online at http://www.theurbanpenguin.com If you have access to a GUI Linux host then you can create many terminal windows so the time a command takes to process becomes less of an issue; however if you have to ssh to your console and you may be limited to a single logon then being able to run processes int he background becomes important once again
Html code for embedding videos on your blog
Text Comments (16)
GSM wave (3 months ago)
really i like your channel , please keep uploading this helpful tips
theurbanpenguin (3 months ago)
thank you
Sourav Goswami (8 months ago)
[email protected] ~ $ type kill kill is a shell builtin [email protected] ~ $ which kill /bin/kill [email protected] ~ $ whereis kill kill: /bin/kill /usr/share/man/man2/kill.2.gz /usr/share/man/man1/kill.1.gz
Sourav Goswami (8 months ago)
for i in {1..20} ; do xeyes&disown ; done
veera Harish (10 months ago)
can you please help me out on this is .We are using RHEL server for apache 2.4.33
veera Harish (10 months ago)
Hi All, While starting apache is runnning like below.How to make it to run as foreground. While grep i need to see start process httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled) Active: active (running) since Sat 2014-07-12 01:53:50 UTC; 1 weeks 3 days ago Process: 21400 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS) Main PID: 390 (httpd) Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec" CGroup: /system.slice/httpd.service ├─ 390 /usr/sbin/httpd -DFOREGROUND ├─15379 /usr/sbin/httpd -DFOREGROUND ├─15858 /usr/sbin/httpd -DFOREGROUND ├─16809 /usr/sbin/httpd -DFOREGROUND ├─16944 /usr/sbin/httpd -DFOREGROUND ├─17079 /usr/sbin/httpd -DFOREGROUND ├─17351 /usr/sbin/httpd -DFOREGROUND ├─17487 /usr/sbin/httpd -DFOREGROUND ├─17772 /usr/sbin/httpd -DFOREGROUND ├─17908 /usr/sbin/httpd -DFOREGROUND └─18043 /usr/sbin/httpd -DFOREGROUND Jul 12 01:53:50 hozen httpd[390]: AH02559: The SSLCertificateChai...d Jul 12 01:53:50 hozen httpd[390]: AH00558: httpd: Could not relia...e Jul 12 01:53:50 hozen systemd[1]: Started The Apache HTTP Server. Jul 13 03:30:02 hozen systemd[1]: Reloading The Apache HTTP Server. Jul 13 03:30:02 hozen httpd[9332]: AH02559: The SSLCertificateCha...d Jul 13 03:30:02 hozen systemd[1]: Reloaded The Apache HTTP Server. Jul 21 03:19:02 hozen systemd[1]: Reloading The Apache HTTP Server. Jul 21 03:19:02 hozen httpd[21400]: AH02559: The SSLCertificateCh...d Jul 21 03:19:02 hozen systemd[1]: Reloaded The Apache HTTP Server. Hint: Some lines were ellipsized, use -l to show in full.
Lauren Shepherd (1 year ago)
My lecture notes say that control+z moves a program to the background. I'm so confused. What does it actually do? It stops a program but only can be used on processes in the foreground? Pls clarify ☺ ~
theurbanpenguin (1 year ago)
Main notes to look at: from the command like $ kill -l #To list signal that can be sent by the command kill $ stty -a #To list bash shortcuts to signals $ man 7 signal #To list the man page for signals
theurbanpenguin (1 year ago)
If you type the command: $ stty -a at your bash prompt you will list keyboard shortcuts to signals. susp = ^Z So Ctrl + Z suspends the currently running process. Typing the command bg sends the process to the background and a resume signal so the process continues processing. You asking what does ctrl + z actually do it does what I said in the video. I am sorry your lecture notes are wrong but surely you should be talking to your lecturer who get paid to teach. If you use man 7 signal you will get a more detailed explanation  of the suspend signal. but it suspends any processing of that process but the process still maintains its current state in memory . This is not the same as stopping a process.Stopping the process would well stop the process removing it from memory as well. So suspends stops CPU processing of that process but it is retained in memory so that it can be resumed. Whereas stopping the processing is really quitting the process or application. You can send signals to any process using the kill command, so the process does not need to be in the foreground. But if you want to use keyboard shortcuts then it has to be in the foreground .  On the command line shortcut you can only address the foreground process but if I found out the process ID with a command like ps or pgrep then I can send a command like kill -sigtstp 23125 (assuming the process ID is 23125) to suspend the process by its ID
Guy Maor (1 year ago)
I'm currently running a process and I want to make it run in the background but I don't want to restart the process. What do I do?
Guy Maor (1 year ago)
theurbanpenguin (1 year ago)
ctrl + z to suspend the app the type bg to restart it in the background
Zach Z (1 year ago)
What's an "amplasand" and "control-zed"?
Djawed M Mazari (7 months ago)
control-zed is meant to be CTRL + Z the other one i don't know.
Kevin Lausen (5 years ago)
I found there is a way to background multiple processes, but how would I choose a program that isn't the most recently backgrounded process to bring to the foreground for stopping, while leaving the other background processes running. I would have RTFM, but there is no man page, I am assuming that no builtins have manpages??
Datan0de (2 years ago)
The jobs command will give you the job number of all background jobs. Then enter "fg [job number]" to bring that particular job to the foreground.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.