Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-09-2006, 04:02 AM
|
#1
|
Member
Registered: Mar 2006
Location: Dhaka,Bangladesh
Distribution: Ubuntu 12.10
Posts: 51
Rep:
|
How to show the list of stopped and background jobs
what command can give me the list of stopped jobs and the programs that are running background e.g running a program by the command play sound.wav & and jobs stoped by ctrl-Z. i know the fg command now i want to know the list of stopped jobs as i can merely do fg of my own choice.
Last edited by fakhrul; 04-09-2006 at 04:04 AM.
|
|
|
04-09-2006, 04:29 AM
|
#2
|
Member
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Rep:
|
use "jobs" it lists all backgrounded processes.
then "fg [number]"
eg:
Code:
$jobs
[1] Stopped vim
[2]- Running play sound.wav &
[3]+ Stopped man ps # the plus sign means this process will be foregrounded if you just type fg without a number
$fg 1 #this would bring vim back to the foreground
*taken from the Slackware Book
Last edited by truthfatal; 04-09-2006 at 04:35 AM.
|
|
1 members found this post helpful.
|
04-12-2006, 03:32 AM
|
#3
|
Member
Registered: Mar 2006
Location: Dhaka,Bangladesh
Distribution: Ubuntu 12.10
Posts: 51
Original Poster
Rep:
|
So much thanx for nice guide. I am really sorry for so delayed response. out of jokes i do bg 1, it sends vim background :-)
I am sorry not to search LQ
Let alone google,
if friends like u give answers who goes for those?
|
|
|
11-13-2008, 04:41 AM
|
#4
|
LQ Newbie
Registered: Nov 2008
Posts: 3
Rep:
|
after session has been terminated
Hi,
One reason for me to start jobs in the background is that i want to disconnect from the server, while the jobs gets done.
But when i come back after having been disconnected, there is no mention of the background job when i type "jobs". (But using "top" i can see that my job is still running)
I can reproduce this on my local ubuntu machine:
## ----
$ vim test.txt &
[1] 9516
$ jobs
[1]+ Stopped vim test.txt
# Now i open another teminal.
$ jobs
$
## ----
I can only see the jobs in the first teminal window (bash).
Is there a way to see (my own) jobs from a different session?
can't find it using google and there doesn't seem to be a manpage for "jobs".
Thanx!
Last edited by rudeboy75; 11-13-2008 at 04:43 AM.
|
|
|
11-13-2008, 07:56 PM
|
#5
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,397
|
It depends exactly what you are trying to do.
When you do
someprog &
it puts it into the background, BUT its still attached to the terminal/login session. If you try to completely logout it should warn you there are running jobs. If you continue to logout, that job should die, although it may possibly hang.
To disconnect the job when starting it, use nohup and '&'
nohup someprog &
from then old days meaning 'no-hangup'.
If its an interactive job you want to be able to re-connect to when you log back in, lookup the 'screen' utility.
See also http://rute.2038bug.com/node12.html....00000000000000
|
|
1 members found this post helpful.
|
01-03-2012, 04:06 AM
|
#6
|
Member
Registered: Apr 2011
Distribution: slackware64-current
Posts: 525
Rep:
|
Quote:
Originally Posted by rudeboy75
Hi,
One reason for me to start jobs in the background is that i want to disconnect from the server, while the jobs gets done.
But when i come back after having been disconnected, there is no mention of the background job when i type "jobs". (But using "top" i can see that my job is still running)
I can reproduce this on my local ubuntu machine:
## ----
$ vim test.txt &
[1] 9516
$ jobs
[1]+ Stopped vim test.txt
# Now i open another teminal.
$ jobs
$
## ----
I can only see the jobs in the first teminal window (bash).
Is there a way to see (my own) jobs from a different session?
can't find it using google and there doesn't seem to be a manpage for "jobs".
Thanx!
|
I would like to know this, too. Has it been resolve here? Thanks
|
|
|
01-09-2012, 09:58 AM
|
#7
|
LQ Newbie
Registered: Nov 2008
Posts: 3
Rep:
|
yes there is, chrism01 gave the right answer.
I resolved this by installing "screen"
And then when i want to do something that takes too long to stay logged in, i use screen like this:
screen -DR
#the terminal turns blank, this is a new screen session.
Then I type the commands that i want executed which will take such a long time (only disadvantage is you can't scroll back up like normal - what is out of your screen is gone, you cannot scoll back up to it)
Then i just close the terminal window. It warns me "There is still a process running in this terminal. Closing the terminal will kill it.", but it won't, because i am using screen.
Then, when I log back in the next hour,day or week (before the next server reboot), i don't see the screen that i was working in. I first need to go back to my screen session with
screen -DR
my terminal now shows the commands that i typed in the screen session, and possibly the output if it is done.
HTH
Last edited by rudeboy75; 01-09-2012 at 10:23 AM.
Reason: typos & correct quotes
|
|
|
All times are GMT -5. The time now is 08:36 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|