Skip to content

Instantly share code, notes, and snippets.

@paulghaddad
Created October 14, 2014 13:50
Show Gist options
  • Save paulghaddad/c3b7cb782fabe11bb570 to your computer and use it in GitHub Desktop.
Save paulghaddad/c3b7cb782fabe11bb570 to your computer and use it in GitHub Desktop.
Level Up 1: Can use ps to find daemon processes
1. If you run the command `ruby -e 'sleep 1 while true'`, you'll start a ruby process that never completes. Try it out and verify that the command never returns. Use the keyboard command to kill it.
Used ctr-c to kill the job
2. Try it again, but append the character that causes the process to run in the background.
ruby -e 'sleep 1 while true' &
3. Use the terminal command to bring it back to the foreground, then use the two keyboard commands to return it to the background.
fg
ctr-Z then bg
4. List the processes on your system and find the PID that corresponds to that ruby script.
ps
My PID is: 45536
5. Since we don't want to repeat that debacle above, use the terminal command to rudely kill the ruby process based on its PID.
kill 45536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment