Q:

how to check OS is linux or other?

we need to check if the following remote ip's are linux OS or other as win
example
12.43.223.4
23.54.67.3
23.5.6.3

we have Linux machine - redhat , and from this machine we need to identify the remote machine if they are Linux or other ? 
as I know we can identify by nmap
but I want to find other way since nmap not installed on production machines
so any suggestion how to check remote machine is Linux or other ? ( not by nmap )

A:

If I understand your question correctly, you are asking;

How can the operating system of a computer on a network be identified without logging in to it

It cannot.
Any computer system on a network, assuming that network is a typical IP (internet protocol) based on TCP/IP communicates based on that protocol.  And if that is all you have to work with, then:

a computer on a network can be configured to be invisible first of all, such as not respond to ping among other things,
but if it does respond or some indication can be seen that there is this computer system on the network, how can you deduce if it is windows, Linux, macOS, Android, other?  You can't: The IP/TCP protocol does not provide for that to happen.

I suppose if a system is somehow configured at a low enough level to include that kind of information in the TCP/IP header in each packet that gets sent out then maybe that can used to work with, but would be very custom.  Otherwise there is no reliable I know of unless you can log in to that system.  If you log in to a system via SSH protocol, well just the same because the SSH protocol is OS-independent, so if you see a computer system responding via SSH on port 22, any computer device with any operating system can do that as long as they follow the SSH protocol which then happens on top of the Internet Protocol.
This is of course is the reason why IP is so great, it allows communication between any device (regardless of operating system) as long as they follow the same internet protocol.  An analogy would be I don't need to know if you are male, female, any other characteristic, as long as you follow the a given language protocol (English language in this case) then we can communicate at some level.
You may wish to read the IPV4 Wikipedia article, in addition to the history of the internet.

A:

for i in  hostname1 hostname2; 
do 
ssh -o 'StrictHostKeyChecking no' $i -A <<'EOF'
uname -a | awk '{if($0 ~ /Linux/){print "Its Linux os"}else{print "its not linux os"}}'
EOF
done

