Search code examples
linuxbashscriptingtelnet

Testing a telnet connectivity for multiple servers from a file


I have a file with 10 servers (one per line) and I need to check from time to time if telnet on port 1231 is opened.

How can I do that using a bash script?

I tried to find a similar topic related to my question on other topics, but I didn't find anything.


Solution

  • If you only want to test if the port is open you can use nmap:

    $ nmap -p23 $ip
    

    setting ip as the IP of the server.