Essential Networking Command-Line Tools Reference

A quick reference guide for essential networking commands in Linux environments, covering OpenVPN management, port testing, and network diagnostics.

Managing OpenVPN Clients

Start and check the status of a specific OpenVPN client configuration:

# Start a specific OpenVPN client profile
sudo systemctl start openvpn@client1

# Check the status of the OpenVPN client
sudo systemctl status openvpn@client1

Testing Server Connectivity with UDP

Use netcat to verify if a UDP port is open on a remote server:

# Test if a UDP port is accessible
nc -v -z -u server port

The -v flag enables verbose output, -z performs a scan without sending data, and -u specifies UDP protocol.

Listing Open Network Ports

View all open network connections and listening ports:

# Display all network connections and listening ports
netstat -an

The -a flag shows all connections and -n displays addresses and port numbers in numerical form.

Finding Processes Using a Specific Port

Identify which process is using a particular port:

# Find process using port 5000
lsof -i :5000

This command lists all processes that have an open file descriptor for the specified port.