Given Linux‘s popularity and adaptability, it is essential for developers and network administrators to understand and be knowledgeable about the various Linux network commands. I’ll give a brief overview of the most used Linux network commands in this article, along with a handy Linux network commands cheat sheet with information on their features and practical applications.
Download Linux Networking Commands Cheat Sheet
What Are Networking Commands in Linux?
On Linux systems, networking commands allow users to manage and monitor network connections and resources. These commands are useful for configuring network interfaces, troubleshooting network connectivity issues, and monitoring network traffic and performance.
Moreover, you can use these commands to view network configurations, configure network interfaces, check network status and connectivity, manage network services, and perform a variety of other networking-related tasks.
Linux Networking Commands Cheat Sheet
Linux networking commands cheat sheet will help you configure, troubleshoot, and monitor network connections. So, if you are a seasoned network administrator or just a beginner exploring Linux networking commands, this command list will be a valuable resource to have.
Network Configuration Commands for Linux Cheat Sheet
Here’s a cheat sheet for Linux network configuration commands that we can use to set up and manage a variety of network settings. Tasks related to network configuration include setting up network interfaces, allocating IP addresses, configuring DNS settings, setting up routing, and managing network security:
Command |
Description |
hostname |
Shows the hostname of the current system |
ip |
Displays and configures network interfaces, routing, and tunnels |
iwconfig |
Displays and configures wireless network interfaces |
netplan |
Configures network interfaces using YAML files |
ifconfig |
Displays and configures the current system’s network interfaces |
ifquery |
Checks the current configuration of network interfaces and their parameters |
nmcli |
Reports network status, manage and configure network connections, and control the NetworkManager |
netplan |
Defines network interfaces, IP addresses, gateways, DNS servers, and other network-related parameters in a YAML configuration file |
ifup |
Activates a network interface that is currently down |
ifdown |
Deactivates a network interface that is currently up |
dhclient |
Automatically obtains an IP address and other network configuration information from a DHCP server |
Network Connectivity Commands
Here, you will find network connectivity commands for managing and monitoring network connections between devices. These commands will enable you to create and close connections and check the performance and status of already established connections:
Command |
Description |
arp |
Map IP addresses to MAC addresses on a LAN and manage ARP cache |
arp -a |
Prints arp table |
arp -a -d |
Deletes all arp table entries |
arp -s |
Adds entry in arp table |
netstat |
Displays active network connections, routing tables, and other network statistics |
netstat -r |
Prints routing table |
ping |
Tests network connectivity among host/server and host by sending packets to a host and measuring the response time |
route |
Configures the kernel’s routing table |
route flush |
Removes all routes |
traceroute |
Displays the route packets take to reach a remote server through multiple hops |
telnet |
Establishes a connection to a remote server/system through a TCP/ IP network using the Telnet network protocol |
w |
Displays information about currently logged-in users |
mail |
Sends and receives email using the command line. |
ngrep |
Displays and filters network packet data on a given regex pattern |
iw |
Displays and configures wireless network interfaces |
DNS and Name Resolution Commands
In this section, I have listed all DNS and name resolution commands you will need to manage and troubleshoot domain name resolution:
Command |
Description |
nslookup |
Performs DNS lookups to resolve hostnames, IP addresses mapping or any specific DNS record |
host |
Performs DNS lookups to resolve hostnames or IP addresses. |
dig |
Performs DNS lookups to query information about DNS name servers |
Network Information Commands for Linux Cheat Sheet
This category includes network information commands that assist users in collecting information about remote systems, domains, and IP addresses:
Command |
Description |
finger |
Shows user login information on a remote system |
jwhois |
Fetches information about domain ownership from various WHOIS servers |
Network Testing and Monitoring Commands
You can use network testing and monitoring commands to perform tasks such as measuring network bandwidth, monitoring network traffic, and troubleshooting network connectivity issues:
Command |
Description |
hping |
Assambles and analyses TCP/IP packets and sends packets to a remote host and analyzes the responses |
mtr |
Works as a combination of traceroute and ping commands, sends packets with the ping time for each hop continuously |
nc / netcat /ncat |
Provides the ability to read and write data across network connections |
smokeping |
Measures network latency and packet loss between two hosts, runs checks in certain intervals |
socat |
Transfers data between two bidirectional byte streams |
speedometer |
Displays bandwidth usage in real-time |
speedtest-cli |
Measures network performance by performing a speed test |
ss |
Displays active network connections, socket statistics, and other network-related information |
tracepath |
Traces the route packets take discovering MTU along this path |
Network Analysis and Monitoring Commands
You can use the network analysis and monitoring commands in this section to display network statistics, capture network packets, and identify performance issues with the network:
Command |
Description |
tcpdump |
Captures and analyzes network traffic in real-time |
nmap |
Scans a network to discover hosts and services or for security |
bmon |
Displays bandwidth usage in real-time for individual network interfaces |
bwm-ng |
Monitors current bandwidth for multiple network interfaces |
iftop |
Displays real-time network bandwidth usage by individual connections |
iperf |
Tests network performance within two systems |
iptraf-ng |
Monitors and displays network traffic in real-time |
nethogs |
Monitors network traffic by process and displays bandwidth usage. |
vnstat |
Keeps track of hourly, daily and monthly network traffic for selected interfaces and displays statistics on a console |
Remote Access Commands for Linux Cheat Sheet
The remote access commands allow you to connect securely to remote servers and manage them remotely from a local terminal. It is mainly essential for system administrators who manage multiple servers remotely and from a single location:
Command |
Description |
ssh |
Securely connects to a remote system using the SSH protocol |
scp |
Copies files securely between client and server using the SSH protocol |
sftp |
Securely transfers files between hosts using the SFTP protocol |
Security Commands
The security commands will assist you in monitoring and controlling various security aspects of your system in order to improve system security:
Command |
Description |
iptables |
Firewall utility that manages packet filtering and NAT. |
snort |
Intrusion detection system that analyzes network traffic for suspicious activity |
wireshark |
Captures and analyzes network traffic in a formatted text |
ufw |
Manages system firewall and adds/deletes/modifies/resets packet filtering rule |
Utility Commands for Linux Cheat Sheet
This section contains utility commands that will allow you to perform useful tasks such as transferring data, downloading files, and changing network interface settings:
Command |
Description |
curl |
Transfers data from or to a server |
aria2 |
Supports various protocols for downloading files from the internet |
ethtool |
Modifies network interface settings, such as speed and queries information of those devices |
wget |
Command-line utility for downloading files from the web |
Conclusion
To conclude, I’ve provided a summary of the various Linux networking command categories, which are crucial tools for network administrators and users who need to manage and troubleshoot network connectivity and performance problems. I hope you find this article and the Linux network commands cheat sheet helpful. If you have any questions or suggestions, please comment below. To improve your understanding of Linux network administration, download the free PDF right away.
People Also Ask
How to check network connectivity in Linux command?
To check network connectivity in the Linux command, you can use the “ping”
command followed by a hostname or IP address of your choice in the terminal. The syntax is "ping <hostname or IP address>"
.
What is the IP command?
The IP (Internet Protocol) command on Linux is one of the most useful and powerful tools for network interface configuration, routing table configuration, and many other networking-related tasks.
How to check IP address in Linux?
To check the IP address in Linux, you can run “ifconfig”
command in your terminal that displays all the information about the IP. Besides, you can use “ip addr”
or “ip a”
to check the IP address in Linux.
What is the command to list networks in Linux?
To list networks in Linux, you can use the “netstat”
command in your terminal. You can run “netstat -a”
to check all the active internet connections.