3 Replies Latest reply on Aug 1, 2014 10:39 AM by Slavko

    Poor man's telnet for Galileo


      If you're coming to Galileo from the Arduino Uno world, it's pretty neat to suddenly have lots more horsepower and a (mostly) full-fledged Linux.  But accessing Galileo's Linux command prompt requires a little effort.  You either need to hook up a custom 1/8" serial cable and find a computer with a serial port and terminal software, or bring up networking on the Galileo, run a special telnetd launch sketch, and telnet in via a telnet-capable client.


      Or you can simply use the tiny attached sketch to talk straight through the cable you just used to program it!


      I use this method  when I want to poke around in Galileo's Linux innards but am feeling too lazy to hook the extra cabling.  Just upload and launch the Arduino console with baud=115200 and "Carriage return" for line terminator.

      The sketch works by sending each line of text you type to the command processor via system() and redirecting output to the special serial device /dev/ttyGS0, which I've learned is the Galileo system-level alias for the Serial.  It's not perfect.  You can't do your own redirects for example, but it's quick, dirty, and EASY.

        • 1. Re: Poor man's telnet for Galileo

          Hi Mikal, I tried it out and it worked OK for me. Like you say its easy. For anyone not unix experienced a couple of commands to try are ls (lowercase LS) to list the files and directories on the flash memory and ps to list all running tasks.


          I was able to make a directory using mkdir but couldn't change into it using cd eg:


          cd sketch



          still lists the root directory.


          Fun to use..

          • 2. Re: Poor man's telnet for Galileo

            The script always spawns a new child prcess. The child process executes the cd command and then dies. The current directory of the parent process is unchanged. When starting another new child with the ls command, this new child will inherit from the unchanged parent current directory.


            To workaround that, group your commands on 1 shell command line


            E.g. try these single-line commands


            sh -c "mkdir myDir; cd myDir; touch myFile1; ls -l"

            sh -c "cd myDir; touch myFile2; ls -l"

            ls -l myDir

            • 3. Re: Poor man's telnet for Galileo

              There is better solution in the 11.GalileoLinux package. The LinuxUSBShell sketch the way to go!

              void setup() {

                system("sed -i 's/S:2345/S0:2345/g' /etc/inittab");

                system("sed -i 's/ttyS1/ttyGS0/g' /etc/inittab");

                system("sed -i 's/grst/#grst/g' /etc/inittab");

                system("sed -i 's/clld/#clld/g' /etc/inittab");

                system("kill -SIGHUP 1");



              I've connected cable (RS-232 -> TTL) to UART1, so just need to change ttyGS0 by ttyS0. It's working like a real console.