LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-15-2009, 10:42 AM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,052

Rep: Reputation: 70
What's the difference between ps -A and jobs...


Aren't they both processes running in the background? Why is it that you can fg bg process listed in jobs whereas in you can't fg and bg processes listed in the ps -A output?
 
Old 04-15-2009, 11:18 AM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
jobs, fg and bg is a separate set of programs than ps.

"Jobs" are more user-controlled, whereas ps is the age-old tool for listing processes. I highly suggest reading the man pages: ps(1) however, it seems jobs, fg and bg do not have any sort of documentation on the Debian Lenny server I am running.
 
Old 04-15-2009, 12:42 PM   #3
maresmasb
Member
 
Registered: Apr 2009
Posts: 108

Rep: Reputation: 24
Information about jobs, bg and fg is part of the BASH_BUILTINS(1) man page. Typing jobs, bg or fg will bring up that man page automatically (at least it does that on Fedora).

ps -A does simply list all processes. No wizardry there.

Last edited by Tinkster; 10-30-2010 at 03:13 PM.
 
Old 04-15-2009, 01:38 PM   #4
jasohl
Member
 
Registered: Oct 2006
Location: Seattle, Washington
Distribution: Gentoo, LinuxMint, Arch Linux
Posts: 99

Rep: Reputation: 18
ps just lists all processes running on the system.
jobs is very different. It is a BASH built-in. It shows jobs that a user or script explicitly put in the background.

press Ctrl-Z while a process is running to suspend it to the background.
use bg jobnumber to resume the process (in the background)
you can start a job in the background by appending a &

Code:
$sh somescript.sh &
the script will start in the background and you will continue to have a bash prompt.
any job will stay in the BG until it finishes or is brought the the fore using fg jobnumber

this allows you to start and control multiple tasks

You can read more:
BASH Job Control
BASH_BUILTINS
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to find the difference betwwn two file and place the difference to other kittunot4u Linux - General 3 07-19-2010 04:26 AM
Printer? How resume Jobs if Printer Stopped: jobs stopped? Reluctant Linux - General 0 06-03-2006 01:36 PM
fg, jobs etc ftgow Linux - General 7 02-26-2004 10:28 PM
What are the Best Jobs associated with Linux? robhargreaves Linux - General 5 01-29-2004 10:34 AM
CRON Jobs scottpioso Linux - Software 63 11-28-2003 06:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:05 PM.

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