LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 04-09-2006, 04:02 AM   #1
fakhrul
Member
 
Registered: Mar 2006
Location: Dhaka,Bangladesh
Distribution: Ubuntu 12.10
Posts: 51

Rep: Reputation: 15
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.
 
Old 04-09-2006, 04:29 AM   #2
truthfatal
Member
 
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Blog Entries: 9

Rep: Reputation: 32
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.
Old 04-12-2006, 03:32 AM   #3
fakhrul
Member
 
Registered: Mar 2006
Location: Dhaka,Bangladesh
Distribution: Ubuntu 12.10
Posts: 51

Original Poster
Rep: Reputation: 15
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?
 
Old 11-13-2008, 04:41 AM   #4
rudeboy75
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Rep: Reputation: 0
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.
 
Old 11-13-2008, 07:56 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
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.
Old 01-03-2012, 04:06 AM   #6
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 516

Rep: Reputation: 50
Quote:
Originally Posted by rudeboy75 View Post
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
 
Old 01-09-2012, 09:58 AM   #7
rudeboy75
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
running jobs on the background feetyouwell Linux - Software 5 09-07-2019 03:13 PM
Kill all Background Jobs jwprz70 Linux - Newbie 10 05-12-2010 01:29 AM
Background jobs paddyjoy Linux - Newbie 2 07-19-2005 01:46 AM
Stopped jobs AndeAnderson Debian 4 03-01-2005 12:15 PM
background jobs seize630 Linux - General 6 10-14-2003 03:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration