These are best practiced in a virtual environment. Docker will do.
$ docker run --rm -it ubuntu /bin/bash
Here we create a background process, capture its process id ( PID ), and then kill it.
Adapted from https://www.pgadmin.org/download/pgadmin-4-python/
docker run -d --name build_pg4admin ubuntu:22.04 sleep inf
{ cat <<'eof'
apt-get update && apt-get install -y python3-pip