Computer process

From Freephile Wiki
Jump to navigation Jump to search

System[edit | edit source]

On a linux system, you can use the ps command to find out about the processes running on the computer.

A favorite incantation is the ps axjf command to show the process tree. Helpful to see children with their parents.

In that tree output, it's easy to see the Process ID (PID) and the Parent Process ID (PPID). Using the PID, you can tell ps to show information only about that process: e.g. ps -p 123 Or, if you know the name of the executable you're interested in, then you can specify it that way: e.g. ps -C java

Sometimes a process is extremely long, and you can't see the whole picture. With the w option, you get a 'wide' readout. Repeat the option (ww) to get unlimited width in the readout. And, the f option shows a "full-format listing". So, for example, when you launch a java app like NetBeans (assuming you find it's pid to be 12657 in this example), and issue ps -p12657 wwf, you'll get something like this:

  PID TTY      STAT   TIME COMMAND
12657 ?        Sl     3:00 /usr/lib/jvm/java-8-oracle/bin/java -Djdk.home=/usr/lib/jvm/java-8-oracle -classpath /home/greg/netbeans-8.0.2/platform/lib/boot.jar:/home/greg/netbeans-8.0.2/platform/lib/org-openide-modules.jar:/home/greg/netbeans-8.0.2/platform/lib/org-openide-util.jar:/home/greg/netbeans-8.0.2/platform/lib/org-openide-util-lookup.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/boot_ja.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/boot_pt_BR.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/boot_ru.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/boot_zh_CN.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-modules_ja.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-modules_pt_BR.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-modules_ru.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-modules_zh_CN.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-util_ja.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-util-lookup_ja.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-util-lookup_pt_BR.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-util-lookup_ru.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-util-lookup_zh_CN.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-util_pt_BR.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-util_ru.jar:/home/greg/netbeans-8.0.2/platform/lib/locale/org-openide-util_zh_CN.jar:/usr/lib/jvm/java-8-oracle/lib/dt.jar:/usr/lib/jvm/java-8-oracle/lib/tools.jar -Dnetbeans.default_userdir_root=/home/greg/.netbeans -Dnetbeans.running.environment=gnome -Dnetbeans.dirs=/home/greg/netbeans-8.0.2/nb:/home/greg/netbeans-8.0.2/ergonomics:/home/greg/netbeans-8.0.2/ide:/home/greg/netbeans-8.0.2/extide:/home/greg/netbeans-8.0.2/java:/home/greg/netbeans-8.0.2/apisupport:/home/greg/netbeans-8.0.2/webcommon:/home/greg/netbeans-8.0.2/websvccommon:/home/greg/netbeans-8.0.2/enterprise:/home/greg/netbeans-8.0.2/mobility:/home/greg/netbeans-8.0.2/profiler:/home/greg/netbeans-8.0.2/python:/home/greg/netbeans-8.0.2/php:/home/greg/netbeans-8.0.2/identity:/home/greg/netbeans-8.0.2/harness:/home/greg/netbeans-8.0.2/cnd:/home/greg/netbeans-8.0.2/dlight:/home/greg/netbeans-8.0.2/groovy:/home/greg/netbeans-8.0.2/extra:/home/greg/netbeans-8.0.2/javacard:/home/greg/netbeans-8.0.2/javafx: -Dnetbeans.home=/home/greg/netbeans-8.0.2/platform -Dnetbeans.importclass=org.netbeans.upgrade.AutoUpgrade -Dnetbeans.accept_license_class=org.netbeans.license.AcceptLicense -Xmx1024m -client -Xss2m -Xms32m -XX:PermSize=32m -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.java2d.noddraw=true -Dsun.java2d.dpiaware=true -Dsun.zip.disableMemoryMapping=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/greg/.netbeans/8.0.2/var/log/heapdump.hprof org.netbeans.Main --cachedir /home/greg/.cache/netbeans/8.0.2 --userdir /home/greg/.netbeans/8.0.2 --branding nb --laf Metal

If you use -F (which implies f), you'll get a few more columns in the output (UID, PPID, C, SZ, RSS, PSR, STIME)