Operations 6 min read

Mastering Linux Process Management: Concepts, Commands, and Scheduling

This guide explains Linux process fundamentals—including definitions, how to view processes with ps and pstree, terminate them with kill, and schedule tasks using at and crontab—providing command syntax, options, and practical examples for effective process monitoring and periodic scheduling.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Mastering Linux Process Management: Concepts, Commands, and Scheduling

Process Latency and Periodic Scheduling

Concept of Processes

Process: an instance of a program that has started execution but has not yet finished.<br/>Program: a file containing executable code.<br/>A process is created from a program; it is a running program that occupies system resources, and a process is not the same as a program.<br/>Processes are classified as interactive processes, batch processes, and daemon processes.<br/>The relationship between processes and programs is many-to-one.

Viewing Processes

Command syntax: ps [options]<br/>Options:<br/>-A: display information of all processes (same as -e).<br/>-a: display information of all user processes.<br/>-f: display full information of processes.<br/>-l: display process information in long format.<br/>-r: display only running processes.<br/>-u: display user-oriented format (including username, CPU and memory usage, etc.).<br/>-x: display processes not attached to a controlling terminal.<br/>-p: display information of the process specified by process ID.<br/>-t: display information of processes on the specified terminal.

Command to View Process Inheritance Tree

pstree displays the process inheritance tree. The tree uses the specified pid as root, or init if none; specifying a user shows only that user's processes.<br/>Syntax: pstree [options] [pid|user]<br/>Options:<br/>-a: display the full inheritance tree; swapped-out processes are shown in parentheses.<br/>-c: separate duplicate process names (default adds *).<br/>pid|user: view processes owned by the specified root pid or user.

Terminating Processes

kill [signal] pid<br/>killall [signal] process_name<br/>Use ps -aux to display processes.<br/>Use pstree to view child processes.

Process Scheduling

One-time Scheduling (at)

Function: schedule a program to run at a specified time.<br/>Syntax: at [-f file] [-m] time<br/>-f: specify a file containing commands to execute.<br/>-m: send mail to the user after the job finishes.<br/>Time can be absolute (MMDDYY or MM/DD/YYYY, today, tomorrow) or relative (now+num+unit, where unit is minutes, hours, days, weeks).<br/>Examples:<br/>at now+1 minutes<br/>at > echo "hell" > /dev/pts/2 (press Enter, then Ctrl+D to finish)<br/>at -f file 17:30+2 days

Periodic Scheduling (crontab)

Function: scheduled service.<br/>crontab –u user {-e | -l | -r}<br/>-u: set scheduled tasks for the specified user.<br/>-e: edit the task list.<br/>-l: view the task list of the specified user (default current user).<br/>-r: delete the task list.<br/>crontab –u user file (file is the task list file).<br/>Task list format: minute hour day month day-of-week command.<br/>Examples:<br/>00 00 */3 * * /path/to/command<br/>0 17 * * 1-5   # Monday‑Friday at 17:00<br/>30 8 * * 1,3,5 # Monday, Wednesday, Friday at 08:30<br/>0 8-18/2 * * * # Every 2 hours between 08:00 and 18:00<br/>0 * */3 * *   # Every 3 days<br/>Schedule directory: /var/spool/scron/root

Link: https://www.cnblogs.com/yanlzy/p/11916911.html

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

process managementlinuxSchedulingpscrontab
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.