Skip to content

Instantly share code, notes, and snippets.

@gpr
Created May 25, 2018 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpr/5209632c7424a678d806f56037537ae8 to your computer and use it in GitHub Desktop.
Save gpr/5209632c7424a678d806f56037537ae8 to your computer and use it in GitHub Desktop.
If you need to emulate a connection to a serial console.
$ brew install socat picocom
$ socat -d -d exec:/usr/bin/login,pty,setsid,setpgid,stderr,ctty pty,raw,echo=0
2018/05/25 23:22:38 socat[81257] N forking off child, using pty for reading and writing
2018/05/25 23:22:38 socat[81257] N forked off child process 81258
2018/05/25 23:22:38 socat[81257] N forked off child process 81258
2018/05/25 23:22:38 socat[81257] N PTY is /dev/ttys004
2018/05/25 23:22:38 socat[81257] N starting data transfer loop with FDs [5,5] and [7,7]
2018/05/25 23:22:38 socat[81258] W setpgid(0, 1): Operation not permitted
2018/05/25 23:22:38 socat[81258] W open("/dev/tty", O_NOCTTY, 0640): Device not configured
2018/05/25 23:22:38 socat[81258] N execvp'ing "/usr/bin/login"
2018/05/25 23:23:19 socat[81257] N childdied(): handling signal 20
2018/05/25 23:23:19 socat[81257] N socket 1 (fd 5) is at EOF
2018/05/25 23:23:20 socat[81257] N exiting with status 0
$ picocom /dev/ttys004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment