Abhishek Gupta
Abhishek Gupta

Reputation: 1193

What is the difference between the jobs and ps commands in linux?

Please tell me the differences in information displayed by two commands jobs and ps in unix operating system?

Upvotes: 11

Views: 16873

Answers (2)

K1773R
K1773R

Reputation: 982

jobs: shows the current jobs living in this terminal as example ->

gedit &
jobs

this will show u gedit is running atm.

if you close the terminal, gedit dies too, you can use disown so it wont die.

ps is a totally different thing, its a process table display tool.

Upvotes: -1

Alan Curry
Alan Curry

Reputation: 14731

jobs is a shell builtin. It tells you about the jobs that the current shell is managing. It can give you information that is internal to the shell, like the job numbers (which you can use in shortcuts like fg %2) and the original command line as it appeared before variable expansions.

ps is an external command which can tell you about all the processes running on the system. (By default it only shows a small subset, but there are options to select larger sets of processes to display.) It doesn't know about the shell-internal stuff.

Upvotes: 26

Related Questions