How to force-close Processing in Linux (or any other application)

KTBYTE students often use a Linux “Virtual Machine” to attend class and share a screen with instructors. However, what should they do if they can’t close a program? One solution, of course, is to restart the virtual machine with the “Restart” button. However, this unfortunately closes everything, preventing you from saving any work! Instead, students can use the linux terminal to close specific programs using the kill and killall commands. Here’s how:
  1. Open the Terminal program by either right clicking on the desktop (“Open Terminal Here”), or click on the applications menu at the top left (“Terminal Emulator”).
  2. To close all Java programs, type killall -9 java , and then press enter.
  3. That’s it! Your Processing will now be closed. This also closes any other Java programs, such as eclipse.
  4. Note that this will not close other students’ copies of java. This is because students are not “super users”, such as the “root” user, and so they can only close their own programs.
What if you want to only close a specific java instance, rather than all copies of Java? That requires a bit more work in the terminal, and is a more advanced topic.
  1. Open up the terminal (same as #1 from the previous list)
  2. Run the following command to find all tasks run by the current user: ps axo user:30,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,comm | grep $(whoami)
    • An even more advanced technique is to restrict the previous command to only include lines with the ‘java’ keyword, by appending another pipe and grep at the end like this:  ps axo user:30,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,comm | grep $(whoami) | grep java
  3. Identify the “Process ID”, the second column in the output of step 2 (note that the first column is simply the linux username). For example, the process ID might be 26660
  4. Close that specific program, 26660, with kill -9 26660
As always, contact KTBYTE support if you have further questions on how to use Linux or your student Virtual Machine

Leave a Reply

Your email address will not be published. Required fields are marked *