DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

TIP: How to transfer terminal session between IDE and terminal Emulator?

Most IDE's embed a terminal session in my case it was the pycharm community (but can apply in most IDEs). On that I was developing a process take long time and I wanted to switch between projects.

But if I did that I was not sure whether the terminal session would end or not. Sometimesd I may even needed to close the IDE as well.

So in my case upon my IDE terminal I've run:

screen
Enter fullscreen mode Exit fullscreen mode

Because, I was developing a python project I needed to re-initialize the virtual environment (ommit if not developing in python):

source ^path_to_venv^
Enter fullscreen mode Exit fullscreen mode

(^path_to_venv^ is the path in which I have initialized the virtual environment if developing upon python replace with your own)

Then I run my script in my case was a python one.
Once my script was running I pressed CTRL+A+D in order to detatch the screen session.

Afterwards, I switched to another project, closing the IDE now was not an issue because the task was running into a detatched session.

If I wanted to see the execution progress of my script now I needed to open any terminal session and run:

screen -r
Enter fullscreen mode Exit fullscreen mode

And then I could re-detatch it by pressing CTRL+A+D again. I could see the progress again by typing screen -r.

I hope it is usefull. I am using linux for my development, Idk if approach above is applicable upon mac as well, I assume it is.

Top comments (0)