>_ IzzyLab

Hands-on task

This task is step 3 of the course “Processes and signals”

How many processes postman has

easy~3 min

Several background processes are running under the service account postman. Count how many processes currently belong to exactly this user and write the number to /root/postman-procs.txt. Note: root also runs something with the word postman in its name — those are not his processes.

What you'll practise:
  • pgrep -u
  • ps -u
  • process owner
  • wc
  • counting processes

Topic breakdown

Every process has an owner — the user it runs as (its UID shows in ps, in the USER column). Processes should be selected by exactly this attribute: pgrep -u and ps -u filter by owner, while a grep over the text of ps aux catches any line containing the name — other users' processes with a similar name and even the grep itself. When counting with ps, remember the header line: it's turned off with a separate option, otherwise the result is one too high.

What's checked

  1. postman's process count is correct

What it looks like