Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-09-2010, 06:39 AM   #1
Registered: Jul 2010
Posts: 44

Rep: Reputation: 0
Question HELP Using telnet command in shell script

I want to test connectivity between different servers using telnet.
I have Name,IP List and port in one file. Please help how i can test connectivity is successful or not?

File format will be:

Output could be
Name1, Successful
Name2, Unsuccessful

I have prepare the code which uses curl and execute complete URL which is as follows:
for url in $(awk -F"," '{print $3}' cp_urls.txt)
curl -s -o "/dev/null" $url
if [ $? -eq 0 ] ; then
echo "$url = running"
echo "$url = not running"
But i want to test connectivity between IP and port number specified.
Please suggest.
Old 08-10-2010, 02:00 AM   #2
Registered: Nov 2003
Location: Belgium
Distribution: Slackware
Posts: 182

Rep: Reputation: 25
you could use the netcat command (sometimes nc)
The version I have has even a command for this
see man nc:
" -z zero-I/O mode [used for scanning]"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to automate TELNET daggulasreedhar Programming 5 08-02-2007 01:13 PM
can we telnet the system using shell script suchi_s Programming 18 02-18-2005 03:43 PM
PB launching shell-script with telnet Naurore Member Success Stories 1 08-04-2003 08:42 AM
PB launching shell-script with telnet Naurore Linux - Newbie 1 08-04-2003 05:45 AM
telnet login via shell script lethe Linux - General 8 05-13-2002 10:31 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration