3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

"nc -z"の代替コマンド

Posted at

CentOS7からncがncatのエイリアスになってしまったようで、「-z」オプションが忽然と消えてしまっています。
様々な代替コマンド(スクリプト)が提案されていますが、下記のものが一番スッキリしているように思います。「$?」でステータスをとって分岐すればポートの死活監視に利用可能です。

timeout 1 bash -c 'cat < /dev/null > /dev/tcp/192.168.0.1/1234'

3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?