I am very new to unix. How can I check that a particular port is free or used right now ?
Use ss command to display all open TCP and UDP ports in Linux. Another option is to use the netstat command to list all ports in Linux. Apart from ss / netstat one can use the lsof command to list open files and ports on Linux based system. Finally, one can use nmap command to check TCP and UDP ports too.
netstat -ano|grep 443|grep LISTEN
will tell you whether a process is listening on port 443 (you might have to replace LISTEN with a string in your language, though, depending on your system settings).
Try (maybe as root)
lsof -i -P
and grep the output for the port you are looking for.
For example to check for port 80 do
lsof -i -P | grep :80
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With