Send file by xmodem or kermit protocol with GNU screen

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
18
down vote

favorite
10












I work with an RS-232 device via GNU screen.



$ screen /dev/ttyUSB0 115200


At some point I need to send a local file to the device using either the xmodem or kermit protocol. On Windows I use TeraTerm which has a corresponding menu item. How can I achieve this in GNU screen?










share|improve this question



























    up vote
    18
    down vote

    favorite
    10












    I work with an RS-232 device via GNU screen.



    $ screen /dev/ttyUSB0 115200


    At some point I need to send a local file to the device using either the xmodem or kermit protocol. On Windows I use TeraTerm which has a corresponding menu item. How can I achieve this in GNU screen?










    share|improve this question

























      up vote
      18
      down vote

      favorite
      10









      up vote
      18
      down vote

      favorite
      10






      10





      I work with an RS-232 device via GNU screen.



      $ screen /dev/ttyUSB0 115200


      At some point I need to send a local file to the device using either the xmodem or kermit protocol. On Windows I use TeraTerm which has a corresponding menu item. How can I achieve this in GNU screen?










      share|improve this question















      I work with an RS-232 device via GNU screen.



      $ screen /dev/ttyUSB0 115200


      At some point I need to send a local file to the device using either the xmodem or kermit protocol. On Windows I use TeraTerm which has a corresponding menu item. How can I achieve this in GNU screen?







      gnu-screen serial-port kermit






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 19 '13 at 18:26









      George M

      8,79623247




      8,79623247










      asked Nov 25 '12 at 9:45







      user14284



























          4 Answers
          4






          active

          oldest

          votes

















          up vote
          19
          down vote













          the best way to pass a file through xmodem is to use sx. In debian this application is part of 'lrzsz' package.



          In debian:




          apt-get install screen lrzsz

          screen /dev/ttyUSB0 115200


          Then press Ctrl-A followed by : and type:




          exec !! sx yourbinary.bin


          This will send the file to ttyUSB0 over xmodem protocol






          share|improve this answer






















          • Can this operation be executed non-interactively, either with screen cu or any other package?
            – Vorac
            Oct 29 '15 at 8:06






          • 1




            @Vorac you can always do sx binary.bin | socat FILE:/dev/ttyUSB0,b115200,raw -
            – GnP
            Mar 24 '16 at 19:59






          • 2




            How to give receive command Give your local XMODEM receive command now
            – AQU
            Jul 31 '17 at 10:10

















          up vote
          4
          down vote













          If you want to use zmodem you have to set the zmodem option to pass, if your screen session is already running, press CTRL+A : and just enter zmodem pass . To send the data just use the sz command from the lrzsz package.



          If you want to receive data via screen you have to set the value to catch.






          share|improve this answer




















          • zmodem catch is an option I've been search for for ages! Good riddance, minicom.
            – ijustlovemath
            Apr 11 '17 at 2:48

















          up vote
          2
          down vote













          I was in need to automate the serial transfer of a .bin file to an xbee with xmodem so I used this sloppy bash code:



          echo "Starting connection..."
          screen -d -m -S uart_con /dev/ttyO1 115200
          sleep 1
          screen -S uart_con -X stuff 'F'$(echo -ne '15')
          sleep 1
          screen -S uart_con -X exec !! sz -X /home/file_directory/example.abs.bin
          echo "now transfering... "
          sleep 20
          pkill screen


          The third line sends a command to the other side(xbee) to start listening for a file transfer. So you are probably good with just:



          screen -d -m -S uart_con /dev/ttyUSB0 115200
          screen -S uart_con -X exec !! sz -X /path_to_file/example.file





          share|improve this answer



























            up vote
            1
            down vote













            If you are trying to do this through screen on OSX, you can follow the procedure laid out by user32704 with some small modifications. You will need to first build lrzsz from source, which can be found here:



            https://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz



            Then, instead of exec !! sx yourbinary.bin you should use:



            exec !! lsz -X yourbinary.bin





            share|improve this answer
















            • 3




              brew install lrzsz
              – Daniele Brugnara
              Sep 2 '16 at 10:34










            • sudo port install lrzsz
              – miken32
              Sep 20 '16 at 17:36










            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f56614%2fsend-file-by-xmodem-or-kermit-protocol-with-gnu-screen%23new-answer', 'question_page');

            );

            Post as a guest





























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            19
            down vote













            the best way to pass a file through xmodem is to use sx. In debian this application is part of 'lrzsz' package.



            In debian:




            apt-get install screen lrzsz

            screen /dev/ttyUSB0 115200


            Then press Ctrl-A followed by : and type:




            exec !! sx yourbinary.bin


            This will send the file to ttyUSB0 over xmodem protocol






            share|improve this answer






















            • Can this operation be executed non-interactively, either with screen cu or any other package?
              – Vorac
              Oct 29 '15 at 8:06






            • 1




              @Vorac you can always do sx binary.bin | socat FILE:/dev/ttyUSB0,b115200,raw -
              – GnP
              Mar 24 '16 at 19:59






            • 2




              How to give receive command Give your local XMODEM receive command now
              – AQU
              Jul 31 '17 at 10:10














            up vote
            19
            down vote













            the best way to pass a file through xmodem is to use sx. In debian this application is part of 'lrzsz' package.



            In debian:




            apt-get install screen lrzsz

            screen /dev/ttyUSB0 115200


            Then press Ctrl-A followed by : and type:




            exec !! sx yourbinary.bin


            This will send the file to ttyUSB0 over xmodem protocol






            share|improve this answer






















            • Can this operation be executed non-interactively, either with screen cu or any other package?
              – Vorac
              Oct 29 '15 at 8:06






            • 1




              @Vorac you can always do sx binary.bin | socat FILE:/dev/ttyUSB0,b115200,raw -
              – GnP
              Mar 24 '16 at 19:59






            • 2




              How to give receive command Give your local XMODEM receive command now
              – AQU
              Jul 31 '17 at 10:10












            up vote
            19
            down vote










            up vote
            19
            down vote









            the best way to pass a file through xmodem is to use sx. In debian this application is part of 'lrzsz' package.



            In debian:




            apt-get install screen lrzsz

            screen /dev/ttyUSB0 115200


            Then press Ctrl-A followed by : and type:




            exec !! sx yourbinary.bin


            This will send the file to ttyUSB0 over xmodem protocol






            share|improve this answer














            the best way to pass a file through xmodem is to use sx. In debian this application is part of 'lrzsz' package.



            In debian:




            apt-get install screen lrzsz

            screen /dev/ttyUSB0 115200


            Then press Ctrl-A followed by : and type:




            exec !! sx yourbinary.bin


            This will send the file to ttyUSB0 over xmodem protocol







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jun 26 '15 at 15:42









            grawity

            1,6071119




            1,6071119










            answered Feb 19 '13 at 17:59









            user32704

            19112




            19112











            • Can this operation be executed non-interactively, either with screen cu or any other package?
              – Vorac
              Oct 29 '15 at 8:06






            • 1




              @Vorac you can always do sx binary.bin | socat FILE:/dev/ttyUSB0,b115200,raw -
              – GnP
              Mar 24 '16 at 19:59






            • 2




              How to give receive command Give your local XMODEM receive command now
              – AQU
              Jul 31 '17 at 10:10
















            • Can this operation be executed non-interactively, either with screen cu or any other package?
              – Vorac
              Oct 29 '15 at 8:06






            • 1




              @Vorac you can always do sx binary.bin | socat FILE:/dev/ttyUSB0,b115200,raw -
              – GnP
              Mar 24 '16 at 19:59






            • 2




              How to give receive command Give your local XMODEM receive command now
              – AQU
              Jul 31 '17 at 10:10















            Can this operation be executed non-interactively, either with screen cu or any other package?
            – Vorac
            Oct 29 '15 at 8:06




            Can this operation be executed non-interactively, either with screen cu or any other package?
            – Vorac
            Oct 29 '15 at 8:06




            1




            1




            @Vorac you can always do sx binary.bin | socat FILE:/dev/ttyUSB0,b115200,raw -
            – GnP
            Mar 24 '16 at 19:59




            @Vorac you can always do sx binary.bin | socat FILE:/dev/ttyUSB0,b115200,raw -
            – GnP
            Mar 24 '16 at 19:59




            2




            2




            How to give receive command Give your local XMODEM receive command now
            – AQU
            Jul 31 '17 at 10:10




            How to give receive command Give your local XMODEM receive command now
            – AQU
            Jul 31 '17 at 10:10












            up vote
            4
            down vote













            If you want to use zmodem you have to set the zmodem option to pass, if your screen session is already running, press CTRL+A : and just enter zmodem pass . To send the data just use the sz command from the lrzsz package.



            If you want to receive data via screen you have to set the value to catch.






            share|improve this answer




















            • zmodem catch is an option I've been search for for ages! Good riddance, minicom.
              – ijustlovemath
              Apr 11 '17 at 2:48














            up vote
            4
            down vote













            If you want to use zmodem you have to set the zmodem option to pass, if your screen session is already running, press CTRL+A : and just enter zmodem pass . To send the data just use the sz command from the lrzsz package.



            If you want to receive data via screen you have to set the value to catch.






            share|improve this answer




















            • zmodem catch is an option I've been search for for ages! Good riddance, minicom.
              – ijustlovemath
              Apr 11 '17 at 2:48












            up vote
            4
            down vote










            up vote
            4
            down vote









            If you want to use zmodem you have to set the zmodem option to pass, if your screen session is already running, press CTRL+A : and just enter zmodem pass . To send the data just use the sz command from the lrzsz package.



            If you want to receive data via screen you have to set the value to catch.






            share|improve this answer












            If you want to use zmodem you have to set the zmodem option to pass, if your screen session is already running, press CTRL+A : and just enter zmodem pass . To send the data just use the sz command from the lrzsz package.



            If you want to receive data via screen you have to set the value to catch.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 25 '12 at 10:52









            Ulrich Dangel

            20k25671




            20k25671











            • zmodem catch is an option I've been search for for ages! Good riddance, minicom.
              – ijustlovemath
              Apr 11 '17 at 2:48
















            • zmodem catch is an option I've been search for for ages! Good riddance, minicom.
              – ijustlovemath
              Apr 11 '17 at 2:48















            zmodem catch is an option I've been search for for ages! Good riddance, minicom.
            – ijustlovemath
            Apr 11 '17 at 2:48




            zmodem catch is an option I've been search for for ages! Good riddance, minicom.
            – ijustlovemath
            Apr 11 '17 at 2:48










            up vote
            2
            down vote













            I was in need to automate the serial transfer of a .bin file to an xbee with xmodem so I used this sloppy bash code:



            echo "Starting connection..."
            screen -d -m -S uart_con /dev/ttyO1 115200
            sleep 1
            screen -S uart_con -X stuff 'F'$(echo -ne '15')
            sleep 1
            screen -S uart_con -X exec !! sz -X /home/file_directory/example.abs.bin
            echo "now transfering... "
            sleep 20
            pkill screen


            The third line sends a command to the other side(xbee) to start listening for a file transfer. So you are probably good with just:



            screen -d -m -S uart_con /dev/ttyUSB0 115200
            screen -S uart_con -X exec !! sz -X /path_to_file/example.file





            share|improve this answer
























              up vote
              2
              down vote













              I was in need to automate the serial transfer of a .bin file to an xbee with xmodem so I used this sloppy bash code:



              echo "Starting connection..."
              screen -d -m -S uart_con /dev/ttyO1 115200
              sleep 1
              screen -S uart_con -X stuff 'F'$(echo -ne '15')
              sleep 1
              screen -S uart_con -X exec !! sz -X /home/file_directory/example.abs.bin
              echo "now transfering... "
              sleep 20
              pkill screen


              The third line sends a command to the other side(xbee) to start listening for a file transfer. So you are probably good with just:



              screen -d -m -S uart_con /dev/ttyUSB0 115200
              screen -S uart_con -X exec !! sz -X /path_to_file/example.file





              share|improve this answer






















                up vote
                2
                down vote










                up vote
                2
                down vote









                I was in need to automate the serial transfer of a .bin file to an xbee with xmodem so I used this sloppy bash code:



                echo "Starting connection..."
                screen -d -m -S uart_con /dev/ttyO1 115200
                sleep 1
                screen -S uart_con -X stuff 'F'$(echo -ne '15')
                sleep 1
                screen -S uart_con -X exec !! sz -X /home/file_directory/example.abs.bin
                echo "now transfering... "
                sleep 20
                pkill screen


                The third line sends a command to the other side(xbee) to start listening for a file transfer. So you are probably good with just:



                screen -d -m -S uart_con /dev/ttyUSB0 115200
                screen -S uart_con -X exec !! sz -X /path_to_file/example.file





                share|improve this answer












                I was in need to automate the serial transfer of a .bin file to an xbee with xmodem so I used this sloppy bash code:



                echo "Starting connection..."
                screen -d -m -S uart_con /dev/ttyO1 115200
                sleep 1
                screen -S uart_con -X stuff 'F'$(echo -ne '15')
                sleep 1
                screen -S uart_con -X exec !! sz -X /home/file_directory/example.abs.bin
                echo "now transfering... "
                sleep 20
                pkill screen


                The third line sends a command to the other side(xbee) to start listening for a file transfer. So you are probably good with just:



                screen -d -m -S uart_con /dev/ttyUSB0 115200
                screen -S uart_con -X exec !! sz -X /path_to_file/example.file






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 21 at 15:39









                Nikos Sakellariou

                211




                211




















                    up vote
                    1
                    down vote













                    If you are trying to do this through screen on OSX, you can follow the procedure laid out by user32704 with some small modifications. You will need to first build lrzsz from source, which can be found here:



                    https://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz



                    Then, instead of exec !! sx yourbinary.bin you should use:



                    exec !! lsz -X yourbinary.bin





                    share|improve this answer
















                    • 3




                      brew install lrzsz
                      – Daniele Brugnara
                      Sep 2 '16 at 10:34










                    • sudo port install lrzsz
                      – miken32
                      Sep 20 '16 at 17:36














                    up vote
                    1
                    down vote













                    If you are trying to do this through screen on OSX, you can follow the procedure laid out by user32704 with some small modifications. You will need to first build lrzsz from source, which can be found here:



                    https://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz



                    Then, instead of exec !! sx yourbinary.bin you should use:



                    exec !! lsz -X yourbinary.bin





                    share|improve this answer
















                    • 3




                      brew install lrzsz
                      – Daniele Brugnara
                      Sep 2 '16 at 10:34










                    • sudo port install lrzsz
                      – miken32
                      Sep 20 '16 at 17:36












                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    If you are trying to do this through screen on OSX, you can follow the procedure laid out by user32704 with some small modifications. You will need to first build lrzsz from source, which can be found here:



                    https://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz



                    Then, instead of exec !! sx yourbinary.bin you should use:



                    exec !! lsz -X yourbinary.bin





                    share|improve this answer












                    If you are trying to do this through screen on OSX, you can follow the procedure laid out by user32704 with some small modifications. You will need to first build lrzsz from source, which can be found here:



                    https://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz



                    Then, instead of exec !! sx yourbinary.bin you should use:



                    exec !! lsz -X yourbinary.bin






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jun 1 '16 at 13:18









                    minn3h

                    111




                    111







                    • 3




                      brew install lrzsz
                      – Daniele Brugnara
                      Sep 2 '16 at 10:34










                    • sudo port install lrzsz
                      – miken32
                      Sep 20 '16 at 17:36












                    • 3




                      brew install lrzsz
                      – Daniele Brugnara
                      Sep 2 '16 at 10:34










                    • sudo port install lrzsz
                      – miken32
                      Sep 20 '16 at 17:36







                    3




                    3




                    brew install lrzsz
                    – Daniele Brugnara
                    Sep 2 '16 at 10:34




                    brew install lrzsz
                    – Daniele Brugnara
                    Sep 2 '16 at 10:34












                    sudo port install lrzsz
                    – miken32
                    Sep 20 '16 at 17:36




                    sudo port install lrzsz
                    – miken32
                    Sep 20 '16 at 17:36

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f56614%2fsend-file-by-xmodem-or-kermit-protocol-with-gnu-screen%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)