Can someone please show me an example of starting a simple background process on the command line; and then later maybe have to open a new command line and then kill the background process?
You can run a process in the background with the
& at the end. After you started the process, you can get the process number (pid) with
$!. later you can use that process number to kill the process.
sleep 60 & SLEEP_PID=$! sleep 2 kill $SLEEP_PID
If you want to use the pid in another shell, you need to save it to a file.
sleep 3600 echo $! > /tmp/pidfile kill $(cat /tmp/pidfile)