Send commands and write data to terminals (/dev/tty
and /dev/pts
devices).
cd
multiple terminals at once when switching to a different project:
$ sudo termecho /dev/pts/2 /dev/pts/3 -- cd ~/path/to/my/project
Write text to a vim
buffer open on another terminal:
$ sudo termecho -n /dev/pts/2 -- Hello from $(tty)
Close vim
on another terminal:
$ sudo termecho /dev/pts/2 -- :wq
There are known security risks
with the TIOCSTI
ioctl syscall and caution is advised. This is intended for
personal use and not for automated production use cases. Please do not
run arbitrary commands through termecho
without inspection (this is generally
good practice anyway).
termecho
is written in Rust, so a Rust installation
is required for compilation.
$ git clone https://github.com/SteadBytes/termecho
$ cd termecho
$ cargo build --release
$ ./target/release/termecho --version
termecho 0.1.0
termecho
uses the TIOCSTI
ioctl
and as such is only available on platforms that support this syscall.