7

I have accidentally closed my machine without clearing a huge Rstudio workspace. Now on starting Rstudio again, it is trying to resume workspace. I have tried killing R session but yet every-time, it starts to load the previous workspace which might take a few days to load. Terminating R will avoid this problem, but only way I know to terminate R is through Rstudio. Is there a way to terminate, not just restart or kill, an R session from terminal. I'm on Ubuntu 18.04. Any help is highly appreciated.

2
  • This link might be helpful - How to stop a running R command in linux other than ctrl+c?. All the best! Commented Feb 10, 2020 at 6:29
  • Yes, I tried that. Looks like an Rstudio session is different from a R session from terminal. It is still loading the workspace. Commented Feb 10, 2020 at 6:30

3 Answers 3

6

Finally, found a workaround from my colleague.

cd .rstudio/ rm -r sessions #this will delete the .RData file from session workspace sudo rstudio-server restart 
Sign up to request clarification or add additional context in comments.

Comments

3

Directly from terminal you do get the ID of the rstudio process using ps aux, and with sudo kill you terminate it:

panther@panther3:~$ ps aux | grep rstudio panther 8500 0.1 0.6 2987220 48436 tty1 Sl+ Okt03 3:37 /usr/lib/rstudio/bin/rstudio panther 8553 0.1 1.1 1197924 93320 tty1 Sl Okt03 3:44 /usr/lib/rstudio/bin/rsession --config-file none --program-mode desktop --www-port 12073 --launcher-token 40641CD7 --show-help-home 1 panther 8559 0.0 0.0 333540 988 tty1 S+ Okt03 0:00 /usr/lib/rstudio/libexec/QtWebEngineProcess --type=zygote --webengine-schemes=qrc:sLV --lang=en-US panther 8561 0.0 0.0 333540 1076 tty1 S+ Okt03 0:00 /usr/lib/rstudio/libexec/QtWebEngineProcess --type=zygote --webengine-schemes=qrc:sLV --lang=en-US panther 18891 0.0 0.0 14752 1000 pts/0 S+ 14:45 0:00 grep --color=auto rstudio panther@panther3:~$ sudo kill -9 8500 

Comments

-1

You can clear your workspace using this button

You can clear your workspace using this button

1 Comment

Any such action from Rstudio won't work while the session is loading.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.