Pause a screen terminal

7,502

Since you started screen with screen -S R, you initially started with a shell inside the screen session, probably bash. So, you could take advantage of bash's job management by pressing Ctrl+Z to suspend the R process, and then resume it later with fg:

[1] 7221
[1] 7222
[1] 7223
[1] 7224
^Z
[1]+  Stopped                 R

$ fg
[1] 7225
Share:
7,502

Related videos on Youtube

user3091668
Author by

user3091668

Updated on September 18, 2022

Comments

  • user3091668
    user3091668 over 1 year

    I constantly use terminal screens to manage different tasks in linux. I would like to know if is possible to 'pause' or 'suspend' a given screen and resume it later (no reboot in between).

    Let's say that I create the following screen:

    screen -S R
    

    Then I start R and let a process running:

    for(lop in 1:1000000){
    print(lop)}
    

    There is a way to say something like:

    screen -X -S R pause
    

    And resume afterwards wit something like:

     screen -X -S R pause
    

    My whole point is to release some processing power temporarily without killing long processes. I would be glad for any light here.

  • Dan
    Dan about 6 years
    The same can be achieved by using kill -s 19 <processid> to pause a process (Sends a SIGSTOP which is the same as the Ctrl+Z shortcut) and kill -s 18 <pid> to resume it (Sends a SIGCONT which is the same as typing fg).