Monday, August 25, 2014

Move program between terminals

Finally I have found an easy way of moving a running program from one terminal to another in Linux.

1. Install a neat program called "reptyr"
     $sudo apt-get install reptyr
2. start a never ending program in one terminal
3. start a second terminal and find the PID of the never ending program by running
     $ps -er | grep nRF  
          -where the "nRF" part is part of the never ending program name
          -you might want to make the terminal window broader to see all the text
4. look after the PID that corresponds to the ps-output:
     pi         2801     2800     1   20:57  pts/1       00:00:01 python3   /home/pi/nRF24L01p.py
          -the PID is the number 2801 in the example above.
5. in the second terminal, run:
     $reptyr 2801
and the second terminal will print out 11 rows of text starting with [+] to tell you everything worked, and at the bottom show the out and input of the program.
The first terminal will go on and ask for a new input and act as if nothing has happened.


Another useful thing with the PID is when you want to kill a process. just type $kill 2801 where 2801 is the PID

2 comments:

  1. MestiQQ Adalah perusahaan judi online KELAS DUNIA ber-grade A

    Sudah saatnya Pencinta POKER Bergabung bersama kami dengan Pemain - Pemain RATING-A

    Hanya dengan MINIMAL DEPOSIT RP. 10.000 anda sudah bisa bermain di semua games.

    Kini terdapat 8 permainan yang hanya menggunakan 1 User ID & hanya dalam 1 website.
    ( POKER, DOMINO99, ADU-Q, BANDAR POKER, BANDARQ, CAPSA SUSUN, SAKONG ONLINE, BANDAR66 )

    PROSES DEPOSIT DAN WITHDRAWAL CEPAT Dan AMAN TIDAK LEBIH DARI 2 MENIT.

    100% tanpa robot, 100% Player VS Player.
    Live Chat Online 24 Jam Dan Dilayani Oleh Customer Service Profesional.

    Segera DAFTARKAN diri anda dan Coba keberuntungan anda bersama MestiQQ
    ** Register/Pendaftaran : WWW-MestiQQ-POKER
    Jadilah Milionare Sekarang Juga Hanya di MestiQQ ^^

    Untuk Informasi lebih lanjut silahkan Hubungi Customer Service kami :
    BBM : 2C2EC3A3
    WA: +855966531715
    SKYPE : mestiqqcom@gmail.com

    ReplyDelete