Files
mkdocs/docs/macos/terminal/reachable.md
2023-11-14 20:35:51 +01:00

118 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Reachable
### ping
```bash
ping -c1 -W1 -q maboiteverte.fr
PING maboiteverte.fr (212.227.191.167): 56 data bytes
--- maboiteverte.fr ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
# immédiat
echo $?
0
```
```bash
ping -c1 -W1 -q clicclac.synology.me
PING clicclac.synology.me (192.168.2.7): 56 data bytes
--- clicclac.synology.me ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss
# immédiat
echo $?
2
```
```bash
ping -c1 -W1 -q google.fr
PING google.fr (216.58.213.67): 56 data bytes
--- google.fr ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 19.936/19.936/19.936/0.000 ms
echo $?
0
```
### nmap
```bash
nmap maboiteverte.fr -PN -p 22 | grep open
22/tcp open ssh
# immédiat
echo $?
0
```
```bash
nmap clicclac.synology.me -PN -p 42666 | grep open
# 2s
echo $?
1
```
```bash
if [ "$?" = 0 ]
then
echo "Host found"
else
echo "Host not found"
fi
```
# nc
```bash
nc -z -G 2 maboiteverte.fr 22
Connection to maboiteverte.fr port 22 [tcp/ssh] succeeded!
# immédiat
echo $?
0
```
```bash
nc -z -G 2 clicclac.synology.me 42666
# 3s
echo $?
1
```
# ssh
```bash
&>/dev/null ssh bruno@maboiteverte.fr true && echo "up" || echo "down"
up
# 2s
```
```bash
&>/dev/null ssh bruno@clicclac.synology.me true && echo "up" || echo "down"
down
# long 75s
```