I'm a complete beginner and I'm looking for some help.

I need to automatically start a command / script at boot to listen for a port from Netcat on computer with Raspbian Desktop version.

If I open the terminal from this computer and manually add the command like "nc -vklp 5555 | /bin/bash", it works fine and from another computer I can access and start a script, for example "echo sudo ./test.sh | nc 5555".

If instead I try to set the computer start listening to Netcat automatically at boot by modifying 'etc/rc.local" and adding "nc -vklp 5555 | /bin/bash" before "exit0", it doesn't work. Says port already in use and not working / not communicating. I have to disable it from "etc/rc.local".

Basically, I have to start Terminal and add the command manually to listen for Netcat otherwise it doesn't work.

Could someone tell me what I'm doing wrong?

Thank you !!!

Ps: apologize for my bad English


1 Answer 1


The main difference between starting from rc.local and starting from command line is that you do not have the same PATH.
If nc is in /usr/bin then use /usr/bin/nc in your script.

  • Also the fact that rc.local runs BEFORE network is up
    – Milliways
    Commented May 14, 2023 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.