Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Processes Pausing and Resuming

What does the `jobs` program do?

On the quiz that follows there is this question:

"What does the jobs program do?"

I figured the answer was "Lists all paused processes on the system" because nothing is listed if I don't have something that I've paused. Yet, the answer is "Shows a list of processes in your current session."

Is the latter what top does? Top shows a lists of processes while jobs is for what's paused.

Am I thinking about this right?

2 Answers

ywang04
ywang04
6,762 Points

Just had a quick test:

root@ubuntu-01:/home/yang# vim hello.txt

[1]+  Stopped                 vim hello.txt

root@ubuntu-01:/home/yang# 
yang@ubuntu-01:~$ jobs
yang@ubuntu-01:~$ 

What I am thinking for the correct answer "Shows a list of processes in your current session." is more focus on your current session as Jobs are per session. As you can see above outputs, the jobs in my own session "yang" doesn't show any paused processes on the system. However, there is one paused process in root session.

In other words, we cannot simply say that "Lists all paused processes on the system".

This is just my thoughts. Any comments are welcome. :)

Think of top as a dynamic list of all processes on the system across all users and jobs as only what the current users session is running. To see this, at the terminal run jobs, then start a process in your session in the background and then run jobs again.

[userprompt ] ~ $ sleep 100&
[userprompt ] ~ $ jobs
[1]+  Running                 sleep 100 &