đź“‹ Command: jobs (The Session Task List)
The jobs command is a shell builtin that lists all active, suspended, or background processes that were started in your current terminal session.
While top or ps show you every process running on your entire CPU system, jobs is more focused—it only tracks what you’ve personally launched in that specific tab.
1. The "Why"
For an Linux power user, jobs is your command-center for multitasking.
- Track Background Tasks: See if that large Java compilation or LaTeX PDF export is still running or if it has finished.
- Manage Suspended Apps: If you forgot you had a text editor or a Quantum Computing simulation paused with
Ctrl + Z,jobswill remind you before you accidentally close the terminal. - Identify IDs: Get the job number (like
[1]or[2]) needed to bring a task back withfgor move it to the background withbg.
2. Understanding the Output
When you run jobs, you’ll typically see something like this:
[1]+ Stopped nano script.sh
[2]- Running ./quantum_simulation.py &
[n]: The Job ID. Use this withfg %norkill %n.+: The "current" job (the onefgwill pick by default).-: The "previous" job.- Status:
- Running: The task is working in the background.
- Stopped/Suspended: The task is paused (usually via
Ctrl + Z). - Done: The task finished since the last time you checked.
3. Essential Flags
| Flag | Purpose | Use Case |
|---|---|---|
jobs -l |
List PIDs | Shows the Process ID (PID) alongside the Job ID—essential if you need to use kill or renice. |
jobs -r |
Running Only | Filters the list to only show active background tasks. |
jobs -s |
Stopped Only | Shows only the tasks you’ve suspended. |
jobs -n |
New Status | Only reports jobs that have changed status since the last notification. |
4. Practical Workflow for Your Setup
- Launch a background task:
./gradlew build &(Starting your Preader Java build in the background). - Suspend a foreground task:
You're editing your E-commerce Blueprint in
vim, and you need to check a file. PressCtrl + Z. - Check your status:
Type
jobs. You’ll see the build Running and the editor Stopped. - Switch back:
Type
fg %2(or whichever ID matches your editor) to resume writing.
5. Pro-Tips
- Auto-Notification: If you hate manually typing
jobsto see if a task is done, you can setset -o notifyin your.bashrcor.zshrc. This tells the shell to inform you the moment a background job finishes. - The Difference from
ps: If you open a new terminal window and typejobs, it will be empty. This is because jobs are "children" of the specific shell instance they started in. To find them from another window, you must useps -u [your_username]. - Arch Linux Context: When testing new Hyprland configurations or running Waybar from the terminal to see error logs, using
jobshelps you ensure you don't have three different versions of the bar running in the background simultaneously.
6. Summary Reference
| Goal | Command |
|---|---|
| List all jobs | jobs |
| List jobs with PIDs | jobs -l |
| Bring job 1 to front | fg %1 |
| Resume job 1 in back | bg %1 |
| Kill a specific job | kill %1 |