Send script to terminal - Solved

Sometimes on rstudio server, I'm logged in on an another server via the terminal (or in R inside a docker container).

Would be great to be able to do CTRL+SHIFT+ENTER or something to send script content to the terminal (rather than the console). (Also would help a lot when using RStudio's shell editing functionality)

rstudioapi package has functions to interact with the terminal (such as terminalSend). Could you use it to create a simple RStudio add-on or a Shiny gadget to do what you want? You can even automate the whole process of opening the ssh connection and launching R in the terminal.

1 Like

That's exactly what I'm after! yes I believe I could, I'll take a look

There's a shortcut that does exactly this. On MacOS it's Option-Cmd-Enter:


I believe it's Ctrl-Alt-Enter on other operating systems (but the menu will tell you for sure).

Does that do what you want?


There is indeed... I swear I looked at this before and did not see that. facepalm