Interrupting R processes in Ubuntu

[This article was first published on The Praise of Insects, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

It’s funny how things happen. Yesterday I was working away on a project in R and the unenjoyable happens—the process hangs for longer than desired. I operate R in the standard GNOME terminal in Ubuntu and the only way I knew was to close the entire application getting rid of all objects at the same time. Not cool. Thirty minutes or more of fruitless searching gave no indication as to a better way of doing things and I was really wishing the ESC key worked as it does in Windows.

Checking emails this morning though, and I discover an exchange on R-help that goes through exactly what I needed to know… From these emails then I have discovered that:
  • Pressing Ctrl+C should work in the terminal.
  • If that doesn’t work, open another terminal console and type
    ps aux | grep R

    kill -s INT PID
  • The first line allows you to discover the PID number of your particular R instance, which is then used in the second line.
  • In the second line above, INT may be replaced by HUP in some cases.
  • The above methods set up an alert-thing to tell the program to stop. When the computations are done externally of R, it can’t be executed before the external codes checks back with R. If the external code doesn’t do this regularly or at all, killing the entire program is the only way out. If none of the above work, this is probably what has happened and it may be a good idea to let the package author know about the problem…
Thanks to all involved in this exchange: Adam Kramer, Duncan Murdoch, Simon Urbanek, Matthew Keller and Ted Harding

To leave a comment for the author, please follow the link and comment on their blog: The Praise of Insects. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)