Mac OS 10.x Check Port Usage

the command for check port usage, in Mac OS 10.x system

//login user port
lsof -Pni4 | grep LISTEN


//root user port
sudo -i //input pass switch to root user
lsof -Pni4 | grep LISTEN