>_ IzzyLab

Hands-on task

This task is step 13 of the course “First steps in Linux”

Find a process and stop it

easy~5 min

An unneeded process, old-report, is running on the server — an old report someone forgot to switch off. Find its number (PID) and stop it with the kill command.

Next to it runs the web-worker process — that's the website, leave it alone.

What you'll practise:
  • ps
  • pgrep
  • kill
  • PID
  • processes

Topic breakdown

Every running program is a process, and each one has a number, its PID. To look at processes:

  • ps aux — every process on the system: owner, PID, CPU load, command;
  • pgrep name — only the PIDs of processes with that name.

To stop a process, you send it a signal with kill and the PID. By default it's a polite request to exit (the TERM signal), and most programs comply.

pgrep sshd        # e.g. 412
kill 412          # ask process 412 to exit

The golden rule is to make sure first that it's the right PID: kill doesn't ask for confirmation.

What's checked

  1. The old-report process stopped
  2. The web-worker process keeps running

What it looks like