LPIC-1 103.5: Creating, watching and killing processes
Job control, a tmux session that outlives your login, signalling
processes by name, and finding the biggest memory users.
Before you start
The lab installs tmux if it's missing. Write answers to the files in
/root/lab-answers/. Running processes don't survive a reboot, so check
before you reboot.
Tasks
- Start
sleep 600, suspend it with Ctrl-Z, list it withjobs, resume it withbg, bring it back withfg, and end it with Ctrl-C. Check it yourself:jobsshows it as Stopped, then Running. - Start a
tmuxsession, runtopin it, detach, log out, log back in and reattach. Leavetoprunning in the session. - Start
sleep 1000 &three times, list them withpgrep -a sleep, and end them all with onepkill. Check it yourself:pgrep -a sleepprints nothing afterwards. - Use
ps -eo pid,%mem,comm --sort=-%mem | headto find the five biggest memory users, and compare withtopsorted by memory. Write their PIDs and names, biggest first, one per line, to/root/lab-answers/4. - Start a CPU-heavy loop in the background (
while :; do :; done &), then runwatch -d uptimeand see the load average climb. Leavewatchwith Ctrl-C and end the loop withkill %1. Check it yourself:jobsis empty afterwards.
Hints
- Ctrl-Z,
jobs,bg %1,fg %1. tmux,top, Ctrl-B thendto detach,tmux ls,tmux attach.pgrep -a,pkill sleep(orpkill -x sleep).- In
top, Shift+M sorts by memory.