Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (9.5k points)

Can anyone tell me how to efficiently check if a port 445 is open/listening on a server with bash script?

1 Answer

0 votes
by (19.7k points)

Below is the code to test for listening on a local server in a script:

exec 6<>/dev/tcp/127.0.0.1/445 || echo "No one is listening!"

exec 6>&- # close output connection

exec 6<&- # close input connection

Interested in Linux? Check out this Linux Certification by Intellipaat.  


 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Feb 18, 2021 in Linux by rahulnayar01123 (6.1k points)
0 votes
1 answer
asked Jul 12, 2019 in AWS by Amyra (12.9k points)
0 votes
3 answers

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...