Networking Commands
1. ip a
It shows detailed information about all network interfaces and
assigned IP address
$ ip a
2. Ping
It is used to test network connectivity between two devices by
sending ICMP (Internet Control Message Protocol) Echo Request
packets.
$ ping [Link]
3. ifconfig
Shows and configures the network interfaces on the current
system.
$ ifconfig wlo1
Displays information about the wlo1 interface.
4. ifquery
Checks the current setup and settings of network
interfaces.
$ ifquery --list
Lists all network interfaces and their settings.
5. nmcli
Reports the network status, manages and configures the
network connections and controls the NetworkManager tool.
$ nmcli dev wifi list
Lists available WiFi networks.
6. arp
Maps IP addresses to MAC addresses on a local network and
manages the ARP cache.
$ arp
Shows the current ARP cache entries.
7. arp -a
Prints the ARP table entries.
$ arp -a
8. netstat
Shows active network connections, routing information, and
other network statistics.
$ netstat -antp
Lists all active network connections and the processes using
them.
9. trace route
It is used to trace the path that packets take from your computer
to a destination (like a website or server).
It helps in network troubleshooting by showing the hops
(routers) between the source and destination.
If don’t have traceroute .just install it by using this command
$ sudo apt install traceroute
$ traceroute [Link]
Traces the route taken to reach [Link]
$ traceroute [Link]
10. telnet
This command is used to establish a remote connection to
another computer or server over the Telnet protocol.
It allows users to communicate with remote machines via a
command-line interface.
If don’t have telnet .just install it by using this command
$ sudo apt install telnet
$ telnet [hostname or IP] [port]
$ telnet [Link] 22
Connects to the SSH server on [Link] via Telnet.
11. iperf
iperf is a command-line tool used to test network bandwidth,
speed, and performance between two systems. It helps measure
network throughput, latency, and packet loss in a controlled
manner.
If don’t have iperf .just install it by using this command
$ sudo apt install iperf
$ iperf -s -- This makes the system listen for incoming network
speed tests.
$ iperf -c [Link] -- This will initiate a bandwidth test
from the client to the server.
12. w
This will Shows the information about users currently logged into
the system.
$w
13. ss
The ss -ntulp command is used to display detailed information
about network connections and listening ports on a Linux
system.
It is a powerful alternative to netstat.
$ ss -ntulp
14. Nslookup
The nslookup command is used to query DNS (Domain Name
System) records and find IP addresses or domain information.
It helps in troubleshooting DNS-related issues.
$ nslookup [Link]
15. host
The host command is used to perform DNS lookups in Linux. It
helps in querying IP addresses, domain names, mail servers (MX
records), and other DNS records.
$ host [Link]
16. dig
The dig (Domain Information Groper) command is used for
querying DNS records in Linux. It is more detailed and flexible
than nslookup or host, making it a preferred tool for DNS
troubleshooting.
$ dig [Link]
17. whois
Retrieves information about domain ownership from various
WHOIS servers.
$ whois [Link]
18. CPU info
To check CPU Information
$ cat /proc/cpuinfo
19. Memory info
To Check Memory Information
$ cat /proc/meminfo
20. speedtest
Runs a speed test to measure download/upload speeds
$speedtest-cli
21. tarcepath
The command identifies paths and latencies from source to
destination, mapping the router and network hops.
$ tracepath [Link]
Run the tracepath command without any options to perform a
simple trace from destination to host:
22. wget
The wget command downloads files from the web using HTTP,
HTTPS, or FTP protocols. The tool is simple to use for file
downloads.
wget [options] [URL]
$ wget [Link]
23. mtr
The mtr command (my traceroute) is a diagnostics tool that
combines elements from the ping and traceroute
commands. The command sends real-time insights into
network quality, making it an excellent tool for
troubleshooting high latency and packet loss.
$ mtr [Link]
24. top
The top command is a network monitoring utility. Use the
command to view network connections and bandwidth usage in
real time.
$ top
25. tcpdump
The tcpdump command is a packet sniffer and network security
tool that captures real-time network packet information. Use
the command to analyze traffic, troubleshoot issues, and
monitor network security.
$ sudo tcpdump port 80
26. iptables
The iptables -L command is used to list all active firewall rules in
a Linux system. iptables is a firewall utility that manages packet
filtering, NAT (Network Address Translation), and security rules.
$ sudo iptables -L
27. Ssh
The ssh user@[Link] command is used to securely
connect to a remote system via SSH (Secure Shell). It allows you
to log into a remote server and execute commands as if you were
physically present.
$ ssh user@[Link]
28. scp
The scp (Secure Copy) command is used to copy files securely
between a local and a remote system using SSH (Secure Shell)
encryption.
scp <source_file>
<user>@<remote_host>:<destination_path>
$ scp [Link] user@[Link]:/path/to/dir
29. Linux Bridge
A Linux bridge acts like a virtual network switch that can
connect multiple network interfaces and allow
communication between them. It is commonly used in
virtualization and networking setups.
Step 1: Install Bridge Utilities
The bridge-utils package is required to manage Linux
bridges.
# apt install bridge-utils
Step 2: Create a New Bridge
Synx : brctl addbr <bridge -name>
# brctl addbr br0
Step 3: Add Network Interfaces to the Bridge
Create new Interface
# ip link set enp2s0 up
# brctl addif br0 enp2s0
To show the bridge details
# brctl show
Spanning Tree Protocol configuration
# brctl stp <bridge> {on|off}
# brctl stp br0 on
Add the entries below into /etc/network/interface
file.
iface eth0 inet manual
iface eth1 inet manual
# Bridge setup
iface br0 inet static
bridge_ports eth0 eth1
address [Link]
netmask [Link]
gateway [Link]