Script to automatically check ports in shell?

Good day,

I'm new to linux environment...Is there any scripts available for me to check ports (lets say port 80 and 21) through shell with just a single commandline?

Any response is very much appreciated..
thanks

check for what?

Are you trying to say that you wanted to check for open ports on a certain machine? If that's the case you can use the nmap utility. Check it's manual.

Hope this helps.

@DukeNuke2
check if the port connection of a particular ip/domain is okay or not...

@yongitz
i'll take alook on that...

tanx 4 ur response...

Another easy way, to check port 80 for example:

if telnet hostname 80 < /dev/null 2>&1 | grep -q Connected
then
    echo its fine
else
    echo port 80 is down!
fi