🔄 Managing Background/Foreground Jobs
In Linux, not all processes need to run in the foreground (your terminal window). Some can run in the background, letting you keep working.
Think of it like multitasking in an office:
You can ask someone to do a task while you continue other work.
Later, you can bring them back to show you progress or adjust their work.
3a. jobs Command
What it does: Lists jobs started in your current terminal session.
Analogy: A manager checks which tasks their employees are currently working on in their office.
Output might show:
- Running → process is in background
- Stopped → process paused (Ctrl+Z)
3b. fg Command
What it does: Brings a background job to the foreground.
Analogy: You call an employee back to your desk to work on the task directly.
- %1 → job number from jobs list
Shortcut: Just fg without a number brings the most recent job to foreground.
3c. bg Command
What it does: Resumes a stopped job in the background.
Analogy: You tell an employee to resume work quietly at their desk while you keep doing your tasks.
- %2 → job number
Tip: If you start a job with & at the end, it automatically runs in the background:
Real-life analogy
✅ Key takeaway:
jobs → see your terminal's tasks
fg → bring a task to foreground
bg → send/resume a task in background
I'll pause here.
Do you understand Managing Background/Foreground Jobs, or want me to give a real-life mini-scenario showing fg/bg in action?