DEV Community

San
San

Posted on • Updated on

Utility CMD for linux

Display a list of ports in use:

sudo lsof -nP -iTCP -sTCP:LISTEN
Enter fullscreen mode Exit fullscreen mode

Check a specific port number with this syntax:

sudo lsof -nP -i:[port-number]
For example, to check if port 5054 is in use, type:
sudo lsof -nP -i:5054
Enter fullscreen mode Exit fullscreen mode

Check Ports via netstat Command

sudo netstat -tunpl

-t - Queries the command for TCP ports.
-u - Queries for UDP ports.
-n - Avoids DNS lookup and shows only IP addresses to speed up the process.
-p - Displays the process ID and the name of the program using the port.
-l - Outputs listening ports.
Enter fullscreen mode Exit fullscreen mode

Give Permission

root@ip-192-168-4-59:/var/www# chmod -R 777 www

root@ip-192-168-4-59:/var/www# chown -R 777 www


Enter fullscreen mode Exit fullscreen mode

For example, to copy a folder named source_folder to a destination directory named destination_folder, you can use the following command:

cp -r source_folder /path/to/destination_folder/

cp -r source_folder /path/to/destination_folder/
cp -r ./var/www/pharmacy_/v18/pharmacy /var/www
Enter fullscreen mode Exit fullscreen mode

Verify the Copied Folder

ls /path/to/destination_folder/
Enter fullscreen mode Exit fullscreen mode

Top comments (0)