Fundamentals 5 min read

Master Linux Process Management: Delays, Scheduling, and Essential Commands

This guide explains Linux process concepts, how to view and trace processes with ps and pstree, terminate them using kill or killall, and schedule one‑time or recurring tasks with at and crontab, providing command syntax, options, and practical examples.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Process Management: Delays, Scheduling, and Essential Commands

Process Concepts

A process is an executing instance of a program; a program is a file containing executable code. Processes consume system resources and differ from programs. Types include interactive, batch, and daemon processes, and the relationship between processes and programs is many‑to‑one.

Viewing Processes

ps [options]
-A  : show all processes (same as -e)
-a  : show processes of all users
-f  : full‑format listing
-l  : long format
-r  : only running processes
-u  : user‑oriented format (user, CPU, memory, etc.)
-x  : show processes without a controlling terminal
-p  : show process by PID
-t  : show processes on a specific terminal

Inspecting Process Hierarchy

pstree [options] [pid|user]
-a  : display full tree, including swapped‑out processes in parentheses
-c  : separate duplicate process names with an asterisk (*)

Terminating Processes

kill [signal] pid
killall [signal] process_name
# Common workflow
ps -aux          # list processes
pstree           # view child processes

Delay (One‑Time) Scheduling

The at command runs a program at a specified time.

at [-f file] [-m] time
-f file   : file containing commands to execute
-m        : mail the user when the job finishes
time      : absolute (MMDDYY or MM/DD/YYYY, today, tomorrow) or relative (now+N minutes/hours/days/weeks)
Example:
at now+1 minutes
at -f myscript.sh 17:30 +2 days

Periodic Scheduling

The crontab utility manages recurring tasks.

crontab -u user -e   # edit/create task list
crontab -u user -l   # list tasks
crontab -u user -r   # remove tasks

Task file format: minute hour day month day‑of‑week command

Examples:
# Mon‑Fri at 17:00
0 17 * * 1-5 /path/to/command
# Mon, Wed, Fri at 08:30
30 8 * * 1,3,5 /path/to/command
# Every 2 hours between 08:00 and 18:00
0 8-18/2 * * * /path/to/command
# Every 3 days
0 * */3 * * /path/to/command

Special symbols:
*  : any value
,  : list of values
-  : range of values
/  : step values

Cron 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.

LinuxSchedulingcrontabat
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.