This question already has an answer here:
- Redirect stdin and stdout to ports 2 answers
Assume I let netcat listen on some port on PC1 (IP:10.0.0.1) with:
PC1:~$ nc -l 9999
I connect from PC2 (IP:10.0.0.2) and send some strings:
PC2:~$ nc 10.0.0.1 9999
hello
touchit
test
what's up
touchit
bye
How do I have to modify the the first command on PC1 such that the command 'touch test.txt' is run on PC1 whenever I send 'touchit' from PC2?
It would be great to do that with a clever combinations of standard command and pipes. Of course, 'touch test.txt' could then be replaced by an arbitrary command. It would be extremely cool, if you could even launch different programs with different command strings sent from PC2.