Mastering Linux Process Management: From Viewing to Scheduling
This guide explains Linux process fundamentals, how to view and trace process hierarchies with ps and pstree, terminate processes using kill, and schedule one-time or recurring tasks via at and crontab, providing command syntax, options, and practical examples.
Process Delay and Periodic Scheduling
Process Concept
Process: an executing instance of a program that has not yet finished.
Program: a file containing executable code.
A process is created from a program and consumes system resources; it is not the same as the program.
Processes can be interactive, batch, or daemon.
The relationship between processes and programs is many‑to‑one.Viewing Processes
Command syntax: ps [options]
Options:
-A : show all processes (same as -e)
-a : show all user processes
-f : full format listing
-l : long format
-r : only running processes
-u : user‑oriented format (user, CPU, memory, …)
-x : show processes without a controlling terminal
-p : show process with given PID
-t : show processes attached to a given terminalViewing Process Inheritance
pstree displays the process hierarchy as a tree.
Usage: pstree [options] [pid|user]
-a : show full inheritance, marking swapped‑out processes with parentheses.
-c : separate duplicate process names with an asterisk.
Specify a pid or user to limit the view.Terminating Processes
kill [signal] pid
killall [signal] process_name
Use ps -aux to list processes and pstree to view child processes.Process Scheduling
Delay Scheduling (at)
Purpose: run a program at a specified time.
Syntax: at [-f file] [-m] time
-f : file containing commands to execute
-m : mail the user when the job finishes
Time formats:
Absolute: MMDDYY or MM/DD/YYYY, or keywords today/tomorrow.
Relative: now+N[minutes|hours|days|weeks].
Examples:
at now+1 minutes
at -f file 17:30+2 daysPeriodic Scheduling (crontab)
Purpose: schedule recurring tasks.
Syntax: crontab -u user {-e | -l | -r}
-e : edit the user’s crontab
-l : list the crontab (default is current user)
-r : remove the crontab
crontab -u user file # load a file as the crontab
Crontab line format: minute hour day month day‑of‑week command
Special symbols:
* : any value
, : list of values
- : range of values
/ : step values
Examples:
0 17 * * 1-5 # 17:00 Monday‑Friday
30 8 * * 1,3,5 # 08:30 on Mon, Wed, Fri
0 8-18/2 * * * # every 2 hours from 08 to 18
0 * */3 * * # every 3 days
Crontab files are stored under /var/spool/cron/ (or /var/spool/scron/root).Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
