Skip to content

Linux Common Commands

Networking

Find the PID of the process using a specific port

Use port 80 as an example:

sudo ss -lptn 'sport = :80'
# State   Local Address:Port  Peer Address:Port
# LISTEN  127.0.0.1:80        *:*                users:(("nginx",pid=125004,fd=12))
# LISTEN  ::1:80              :::*               users:(("nginx",pid=125004,fd=11))

Add a user account

Add a user called username with password password

useradd -s /bin/bash -d /home/username/ -m -G sudo username
usermod -aG sudo username
echo "username:password" | chpasswd