Fundamentals 6 min read

Mastering Linux Process Management and Scheduling with ps, pstree, at & crontab

This guide explains Linux process concepts, how to list and inspect processes using ps and pstree, terminate them with kill or killall, and schedule one‑time or recurring tasks via the at and crontab utilities, complete with command syntax and examples.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Mastering Linux Process Management and Scheduling with ps, pstree, at & crontab

Process Concepts

A process is an executing instance of a program that occupies system resources; it differs from the program file itself. Processes can be interactive, batch, or daemon, and the relationship between processes and programs is many‑to‑one.

Viewing Processes

ps [options]

Common options: -A or -e: show all processes -a: show all user processes -f: full‑format listing -l: long format -r: only running processes -u: user‑oriented format (includes user, CPU, memory) -x: processes without a controlling terminal -p: specify PID -t: specify terminal

Inspecting Process Hierarchy

pstree [options] [pid|user]
pstree

displays processes in a tree structure, rooted at init or a given PID/user. Options: -a: show full command line and swapped‑out processes (in parentheses) -c: separate duplicate process names with an asterisk

Terminating Processes

kill [signal] pid
killall [signal] process_name

Use ps -aux to list processes and pstree to view child processes before terminating.

One‑Time (Delayed) Scheduling with at

at [-f file] [-m] time

Options: -f: specify a file containing commands to execute -m: mail output to the user after the job finishes

Time can be absolute (e.g., MMDDYY or MM/DD/YYYY, today, tomorrow) or relative (e.g., now+5 minutes, now+2 days).

Example:

at now+1 minutes

Periodic Scheduling with crontab

crontab -u user {-e | -l | -r}
-e

: edit the user’s crontab -l: list the crontab -r: remove the crontab

Crontab file format: minute hour day month day-of-week command Special symbols: *: any value ,: list of discrete values -: range of values /: step values

Examples:

Weekdays at 17:00: 0 17 * * 1-5 Mon, Wed, Fri at 08:30: 30 8 * * 1,3,5 Every 2 hours between 08:00 and 18:00: 0 8-18/2 * * * Every 3 days: 0 * */3 * * Crontab files are stored under /var/spool/cron (e.g., /var/spool/cron/root).

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.

LinuxprocesspscrontabOS fundamentalsat
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.