• Skip to main content
  • Skip to primary sidebar
  • Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / Linux sysadmin tutorials linux system administrator / Linux Networking Commands Cheat Sheet with Examples pdf

Linux Networking Commands Cheat Sheet with Examples pdf

Table of Contents

Toggle
  • Linux Networking Commands Cheat Sheet
    • 🌍 Network Configuration Commands
    • πŸ“‘ Network Connectivity & Testing
    • πŸ” Find Open Ports & Network Services
    • πŸ“Ά Monitor Network Traffic
    • πŸ›  Firewall Management (iptables & firewalld)
    • πŸ”— Network Interface Management
    • πŸ“‘ Set Up & Manage Routes
    • πŸš€ Advanced Networking Commands
    • πŸ”Ž Scan & Detect Network Issues
    • πŸ“ 1. Check Network Configuration
      • πŸ“Œ Command: ip a – Show IP addresses and interfaces
    • 🌍 2. Test Network Connectivity
      • πŸ“Œ Command: ping – Check if a host is reachable
    • πŸš€ 3. Check Network Routes
      • πŸ“Œ Command: ip route – Show routing table
      • πŸ“Œ Command: traceroute – Show path to a destination
    • πŸ“‘ 4. Scan Open Ports and Listening Services
      • πŸ“Œ Command: netstat (Older) or ss (Newer Alternative)
    • πŸ” 5. Find Network Interfaces and Traffic Stats
      • πŸ“Œ Command: ip -s link – Show interface statistics
      • πŸ“Œ Command: ifconfig (Deprecated)
    • 🌍 6. Test DNS Resolution
      • πŸ“Œ Command: nslookup – Find IP of a domain
      • πŸ“Œ Command: dig – Detailed DNS lookup
    • πŸ“Ά 7. Monitor Network Traffic
      • πŸ“Œ Command: tcpdump – Capture network packets
      • πŸ“Œ Command: iftop – Monitor bandwidth usage
    • πŸ› οΈ 8. Manage Firewall Rules
      • πŸ“Œ Command: iptables – Configure firewall rules
    • πŸ”Ž 9. Scan Network for Active Devices
      • πŸ“Œ Command: nmap – Scan devices and open ports
    • πŸš€ 10. Test and Manage Network Speed
      • πŸ“Œ Command: speedtest-cli – Check internet speed
      • πŸ“Œ Command: tc – Simulate network latency
  • πŸš€ BONUS: Advanced Linux Networking Commands
      • πŸ”„ Restart Network Services
      • 🌐 Find Public IP Address
      • πŸ“‘ Find Default Gateway
      • ifconfig replacement command is IP

Linux Networking Commands Cheat Sheet

A quick reference for essential Linux networking commands to help troubleshoot, configure, and monitor networks efficiently. πŸš€


Linux Networking Commands

🌍 Network Configuration Commands

Command Description
ip a Show IP addresses and interfaces (use instead of ifconfig).
ip link show Display all network interfaces.
ip route show Show routing table (default gateway, subnets, routes).
ip addr show Displays IP addresses, similar to ifconfig
ifconfig Display or configure network interfaces (deprecated).
nmcli dev status Show NetworkManager status for all interfaces.

Linux_Networking_Commands_Cheat_Sheet .pdf

πŸ“‘ Network Connectivity & Testing

Command Description
ping -c 4 google.com Send 4 ICMP packets to check connectivity.
traceroute google.com Show path taken by packets to destination.
mtr google.com Combination of ping and traceroute (real-time).
dig google.com Query DNS records for a domain.
nslookup google.com Get DNS resolution for a domain.
curl -I https://google.com Check website response headers.

πŸ” Find Open Ports & Network Services

Command Description
netstat -tulnp Show active ports and services (deprecated).
ss -tulnp Show open ports and listening services (modern alternative).
lsof -i :80 Find process using port 80.
nmap -p 22 192.168.1.1 Scan port 22 (SSH) on a specific device.
nmap -sn 192.168.1.0/24 Scan active devices on a subnet.

πŸ“Ά Monitor Network Traffic

Command Description
tcpdump -i eth0 port 80 Capture network packets on port 80.
iftop -i eth0 Show bandwidth usage per connection.
nload Display live network bandwidth usage.
bmon Interactive bandwidth monitoring tool.
ip -s link Show interface traffic statistics.

πŸ›  Firewall Management (iptables & firewalld)

Command Description
iptables -L -n -v List all firewall rules.
iptables -A INPUT -p tcp --dport 22 -j ACCEPT Allow SSH traffic.
iptables -A INPUT -p tcp --dport 80 -j DROP Block HTTP traffic.
firewall-cmd --list-all Show current firewalld settings.
firewall-cmd --add-port=8080/tcp --permanent Open port 8080 permanently.

πŸ”— Network Interface Management

Command Description
ip link set eth0 up Enable network interface.
ip link set eth0 down Disable network interface.
dhclient eth0 Obtain IP address via DHCP.
ethtool eth0 Display Ethernet settings.

πŸ“‘ Set Up & Manage Routes

Command Description
ip route add default via 192.168.1.1 Set default gateway.
route -n Show routing table (deprecated).
ip route del default Remove default route.

πŸš€ Advanced Networking Commands

Command Description
tc qdisc add dev eth0 root netem delay 100ms Simulate network latency.
tc qdisc del dev eth0 root Remove latency settings.
curl ifconfig.me Get public IP address.
wget http://speedtest.tele2.net/1MB.zip Download a test file to check network speed.

πŸ”Ž Scan & Detect Network Issues

Command Description
arp -a Show ARP table (MAC addresses of connected devices).
whois google.com Get domain registration details.
hostname -I Get local machine IP address.
systemctl restart networking Restart networking service.

These Linux networking commands will help you troubleshoot, monitor, and configure networks efficiently. πŸš€


πŸ“ 1. Check Network Configuration

πŸ“Œ Command: ip a – Show IP addresses and interfaces

bash
ip a

πŸ”Ή Example Output:

sql
2: eth0: <UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10/24 brd 192.168.1.255 scope global eth0

βœ… Shows IP addresses, MAC addresses, and interface statuses.


🌍 2. Test Network Connectivity

πŸ“Œ Command: ping – Check if a host is reachable

bash
ping -c 4 google.com

πŸ”Ή Sends 4 packets to check connectivity.
πŸ”Ή If packets are lost, there might be network issues.


πŸš€ 3. Check Network Routes

πŸ“Œ Command: ip route – Show routing table

bash
ip route

πŸ”Ή Displays default gateway, subnet routes, and interface routes.

πŸ“Œ Command: traceroute – Show path to a destination

bash
traceroute google.com

πŸ”Ή Displays all the hops a packet takes to reach its destination.


πŸ“‘ 4. Scan Open Ports and Listening Services

πŸ“Œ Command: netstat (Older) or ss (Newer Alternative)

bash
netstat -tulnp # Show active ports and processes
ss -tulnp # Faster alternative to netstat

πŸ”Ή t = TCP, u = UDP, l = Listening, n = Numeric, p = Process

πŸ”Ή Example Output:

nginx
tcp LISTEN 0 50 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=1234,fd=3))

βœ… This means SSH is listening on port 22.


πŸ” 5. Find Network Interfaces and Traffic Stats

πŸ“Œ Command: ip -s link – Show interface statistics

bash
ip -s link

βœ… Displays sent/received packets and errors.

πŸ“Œ Command: ifconfig (Deprecated)

bash
ifconfig eth0

βœ… Shows interface details (IP, MAC, status).
(Use ip a instead in modern Linux systems.)


🌍 6. Test DNS Resolution

πŸ“Œ Command: nslookup – Find IP of a domain

bash
nslookup google.com

βœ… Shows Google’s IP addresses from your DNS server.

πŸ“Œ Command: dig – Detailed DNS lookup

bash
dig google.com

βœ… Provides detailed DNS resolution info.


πŸ“Ά 7. Monitor Network Traffic

πŸ“Œ Command: tcpdump – Capture network packets

bash
tcpdump -i eth0 port 80

βœ… Captures HTTP traffic on eth0 interface.

πŸ“Œ Command: iftop – Monitor bandwidth usage

bash
sudo iftop -i eth0

βœ… Shows live network bandwidth usage per connection.


πŸ› οΈ 8. Manage Firewall Rules

πŸ“Œ Command: iptables – Configure firewall rules

βœ… Block incoming traffic on port 80:

bash
iptables -A INPUT -p tcp --dport 80 -j DROP

βœ… Allow SSH (port 22) traffic:

bash
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

βœ… List all rules:

bash
iptables -L -n -v

πŸ”Ž 9. Scan Network for Active Devices

πŸ“Œ Command: nmap – Scan devices and open ports

bash
nmap -sn 192.168.1.0/24 # Ping scan for active devices
nmap -p 22 192.168.1.1 # Scan SSH port on a specific device

βœ… Helps identify online devices and security vulnerabilities.


πŸš€ 10. Test and Manage Network Speed

πŸ“Œ Command: speedtest-cli – Check internet speed

bash
speedtest-cli

βœ… Shows upload/download speed.

πŸ“Œ Command: tc – Simulate network latency

βœ… Add 100ms delay to all outgoing packets:

bash
tc qdisc add dev eth0 root netem delay 100ms

βœ… Remove delay:

bash
tc qdisc del dev eth0 root netem

πŸš€ BONUS: Advanced Linux Networking Commands

πŸ”„ Restart Network Services

bash
systemctl restart networking

βœ… Restart the network service after changes.

🌐 Find Public IP Address

bash
curl ifconfig.me

βœ… Displays your external IP address.

πŸ“‘ Find Default Gateway

bash
ip route | grep default

βœ… Shows your default gateway (router IP).

ifconfig replacement command is IP

  • The ip command is more powerful and flexible than ifconfig, and it’s designed to work with the newer Linux networking stack.
  • Alternatives to ifconfig for specific tasks:
    • To display IP addresses: ip addr show.
    • To bring an interface up: ip link set <interface> up.
    • To bring an interface down: ip link set <interface> down.
  • Examples of ip commands:
    • ip addr: Displays IP addresses, similar to ifconfig.
    • ip link: Manages network interfaces (e.g., bring up/down, change MTU).
    • ip route: Manages routing tables.
    • ip tunnel: Configures IP tunnels.

Primary Sidebar

Linux sysadmin tutorials linux system administrator

  • top 10 apt & apt-get commands (most used) apt vs apt-get
  • If-Else Statements in Shell Scripting
  • linux commands pdf (files & Directories, zip & unzip process, search etc)
  • Find Files with Specific Text on Linux grep find command
  • linux performance tuning inode limit file descriptors tco, kernel etc
  • Variables and Data Types in Shell Scripting
  • Top 10 most used Cat commands with examples (create, view, append files)
  • Ip tables / ufw / firewall d commands for block port ip rate limiting
  • Top 10 zip / tar commands to compress & extract files in linux
  • TOP 10 mv & cp commands in linux to move & copy files in Linux
  • Top 10 GREP Commands in linux to search files directory words strings
  • lsof netstat commands to know listening ports in linux 3 ways
  • Upgrade Ubuntu from 18.04 (19.10) to 20.04 LTS command line or gui server | desktop
  • 3 Ways (SCP, rsync, Sftp) linux server migration between two remote server apache nginx
  • linux system specs commands (CPU, Memory, Disk )speed, type. manufacture
  • linux sysctl command tweaks & hardening
  • linux security limits.conf deciding user limits process limits for nginx server
  • ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.
  • red hat linux certification cost jobs salary syllabus courses fees
  • ufw firewall commads allow port enable disable ubuntu 20.04
  • ddos attack prevention
  • change ssh port in linux - avoid sshd ddos attacks
  • ping command
  • memcached install ubuntu wordpress
  • check linux version (lsb_release -a) ubuntu debian 32 or 64 bit
  • rsync command linux with examples comparison to scp
  • how to uninstall package in linux ubuntu rpm, yum apt-get
  • increase open file limit linux File descriptor ft nginx , mysql, lemp
  • remove repository ubuntu
  • htop commad memory details virtual vs shard vs resident
  • chown command in Linux with Examples
  • Kill PHP process
  • VIrtual Memory vs RSS Memory vs Shared memory in Linux
  • oom killer fixing it by configuration linux ubuntu
  • Install Lemp nginx mysql php fpm Stack on Debian 11 with repository
  • connect two remote servers linux command line
  • auto start after oom killer Mysql & php fpm nginx etc ubuntu wth systemd or cron job
  • load average Linux 1, 5, 15 min 2,4,8 cores explained
  • Control Structures in Shell Scripting
  • Shell Scripting Roadmap for Beginners to Advanced
  • awk commands with practical examples
  • Shell Scripting Tutorial for Beginners πŸš€
  • find Command in Linux with Examples
  • sed Command in Linux with Examples (Beginner to Advanced)
  • Linux Text processing commands in with Examples
  • linux disk management commands
  • fdisk command in linux with examples
  • how to add a new disk in linux
  • Linux mount Command with Examples
  • fstab options with examples
  • Top 50 Shell Scripting Interview Questions and Answers
  • Linux Networking Interview Questions and Answers
  • Linux Networking Commands Cheat Sheet with Examples pdf
  • Netstat & SS Commands cheat sheet with examples Interview Questions
  • Nmap Cheat Sheet – Network Scanning & Security
  • Bash Brackets ([], (), {}, $( ), $(( ))) – Types, Uses & Examples

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

Β© 2025 - All Rights Reserved Disclaimer & Privacy Policy