ps (Process List)

ps — show the process list of the running Unix processes

Ok, now the right way to do this is to search you process list. To do that you use this:

ps aux |grep <WHAT YOU ARE SEARCHING FOR>

Be sure that <WHAT YOU ARE SEARCHING FOR> is a substring for a name of the job (unix process) that you are searching for.

Secondly, notice that this specific Unix command has some funny “flags” — aux — that appear without a dash proceeding them unlike other Unix command modifiers you may be used to. Finally, the |grep on the end tells Unix to search all the processes for a matching result. When you |grep, you are filtering. After a space between the preceding flag, type |grep, then space, then the thing to filter for.

So for example, to “grep” for (or search for) all processes that contain the string “car”, I search on my Mac and get

$ ps aux |grep car

And here’s my results:

jason              561   0.0  0.0  4821940   3044   ??  S    Sat06PM   0:00.84 /usr/libexec/SidecarRelay

jason            74549   0.0  0.0  4277500    688 s004  S+    2:18PM   0:00.01 grep car

Finally, notice how this actually returns the grep process itself, because while it is running it also has the word ‘car’ in it, so you see the process basically report itself. (That’s useless because of course that’s not the one you want, so just ignore it.)

ps will show you the running processes on your hard drive. If you run it “naked,” (no flags), it will show you only your own user processes. To show all the system process also, run ps x

ps aux |grep unix

Here you’ll want to actually run

ps aux |grep spring

You’ll want to use ps with |grep spring with Rails 6, but if you boot with Puma (previous versions of Rails), you can |grep rails.

This reveals something important: the unix process id number. The number to the leftmost of your ps output is your process id number.

the unix process id is displayed

When you need to kill a hanging process forcibly, you this is how you find its Unix process id number.