Cyber
Public
School
CYBER PUBLIC SCHOOL
Linux Networking
Commands
https://cyberpublicschool.com/
Linux Networking
Commands
CYBER PUBLIC SCHOOL
https://cyberpublicschool.com
INTRODUCTION
What is Linux?
Linux is a free and open-source operating system (OS),
meaning its source code is publicly available and can be
modified and redistributed by anyone. This sets it apart from
closed-source commercial operating systems like Windows or
macOS.
What is Linux Networking Commands?
Linux networking commands are tools you can use within the
Linux terminal to manage, configure, diagnose, and
troubleshoot various aspects of your computer's network
connections.
CYBER PUBLIC SCHOOL
They empower you to:
View network configuration: Check IP addresses, network
interfaces, routing tables, DNS settings, and more.
Modify network settings: Change IP addresses, add routes,
set up wireless connections, and configure firewalls.
Test network connectivity: Check if hosts are reachable, trace
network paths, and measure network performance.
Analyze network traffic: Capture and inspect network packets
for troubleshooting and security purposes.
https://cyberpublicschool.com
List of Essential Linux Networking Commands
1. ip:
Purpose: Comprehensive command for configuring and
managing network interfaces, addresses, routes, and more.
Common subcommands:
ip addr : Manage IP addresses of interfaces.
ip link : Manage link status and properties of interfaces.
ip route: Manage routing table entries.
Examples:
ip addr add 192.168.1.10/24 dev eth0 to add an IP address to
eth0.
ip link set eth0 up to bring up the eth0 interface.
ip route add CYBER
default PUBLIC SCHOOL
via 192.168.1.1 to set the default
gateway.
https://cyberpublicschool.com
2. ifconfig:
Purpose: Older command for viewing and configuring network
interfaces (being replaced by ip). Common uses:
ifconfig eth0 up : Bring up the eth0 interface.
ifconfig eth0 192.168.1.10 netmask 255.255.255.0: Assi :
Assign an IP address and subnet mask to eth0.
3. ping:
Purpose: Checks reachability of a host by sending ICMP echo
requests.
Example: ping 8.8.8.8 to ping Google's DNS server. Options:
-c count: Specifies the number of packets to send.
-i interval: Sets the interval between packets.
CYBER PUBLIC SCHOOL
4. traceroute/tracepath:
Purpose: Traces the path packets take to a destination host,
revealing network hops.
Example: traceroute example.com to trace the route to a
website.
https://cyberpublicschool.com
5. netstat:
Purpose: Displays network connections, routing tables, and
interface statistics.
Common options:
-a: Display all sockets (TCP, UDP, etc.).
-n: Do not resolve names.
-p: Show process IDs associated with sockets.
6. ss:
Purpose: More modern alternative to netstat with enhanced
features.
Common options:
-t: Display TCP connections.
-u: Display UDP connections.
-l: Display listening sockets.
-p: Show process IDs associated with sockets.
CYBER PUBLIC SCHOOL
7. dig/nslookup:
Purpose: Query DNS servers for domain name information.
Example: dig example.com to lookup DNS records for a
website.
9. arp:
Purpose: Displays or manipulates the system's ARP cache
(Address Resolution
Protocol).
Common options:
-a: Display all entries in the ARP cache.
-d: Delete an entry from the ARP cache.
https://cyberpublicschool.com
10. route:
Purpose: Displays or manipulates the system's routing table.
Common commands:
route add: Add a route.
route del: Delete a route.
route show: Display the routing table.
11. iwconfig:
Purpose: Configures wireless network interfaces.
Common uses:
iwconfig wlan0 essid "MyWiFi" to connect to a wireless
network.
iwconfig wlan0 key s:password to set the wireless password.
12. curl/wget:
Purpose: Download files from the internet.
CYBER
Example: curl -O PUBLIC SCHOOL to download a
https://example.com/file.zip
file.
13. mtr:
Purpose: Combines traceroute and ping functionality for
continuous network
monitoring.
Example: mtr example.com to monitor the route to a website.
https://cyberpublicschool.com
14. whois:
Purpose: Queries WHOIS databases for domain name
registration information.
Example: whois example.com to lookup WHOIS data for a
website.
15. cpdump:
Purpose: Captures and analyzes network packets.
Common uses:
tcpdump -i eth0 to capture packets on the eth0 interface.
tcpdump -n -G 'src 192.168.1.10': Capture packets originating
from the IP
address 192.168.1.10 without name resolution.
16. iw:
Purpose: Modern command for managing wireless network
interfaces. CYBER PUBLIC SCHOOL
Examples:
iw dev to list wireless interfaces.
iw wlan0 scan to scan for available wireless networks.
17. nmap:
Purpose: Performs port scans and security audits of networks.
Common uses:
nmap -p 22 example.com: Scan the SSH port (22) on
example.com.
nmap -sT -Pn example.com: Scan example.com with TCP SYN
stealth scan (no pings).
https://cyberpublicschool.com
18. dnsmasq:
Purpose: Acts as a DNS forwarder and DHCP server.
Common uses:
Set up a local DNS server for internal domain names.
Assign IP addresses to devices automatically on a network.
19. iptables/nftables:
Purpose: Configure firewall rules to control network traffic.
Common uses:
Block incoming connections on port 80 (HTTP).
Allow only specific IP addresses to access a server.
20. ssh:
Purpose: Securely login to remote Linux machines.
Example: ssh username@example.com: Login to the user
account "username"
CYBER PUBLIC SCHOOL
on example.com.
21.hostname
- Show or set the system's host name.
Hostname
22. tcpdump
- Dump traffic on a network.
tcpdump -i eth0
https://cyberpublicschool.com
23. sshd
- OpenSSH daemon.
service sshd restart
24. telnet
- User interface to the TELNET protocol.
telnet google.com 80
25. scp
- Secure copy (remote file copy program).
scp file.txt user@remote:/path/to/destination
26. wget
- Non-interactive network downloader.
wget
Example Domains
As described inCYBER
RFC 2606PUBLIC SCHOOL
and RFC 6761, a number of domains
such as example.com and example.org are maintained for
documentation purposes. These domains may be used as
illustrative examples in documents without prior coordination
with us. They are not available for registration or transfer.
We provide a web service on the example domain hosts to
provide basic information on the purpose of the domain.
These web services are provided as best effort, but are not
designed to support production applications. While incidental
traffic for incorrectly configured applications is expected,
please do not design applications that require the example
domains to have operating HTTP service.
https://cyberpublicschool.com
27. iptraf
- Interactive color IP LAN monitor.
Iptraf
28. iftop
- Display bandwidth usage on an interface.
Iftop
29. lsof
- List open files.
lsof -i :80
30. ethtool
- Display or change ethernet card settings.
ethtool eth0
31. arp CYBER PUBLIC SCHOOL
- Display or modify the ARP cache.
arp -a
32. route
- Display or modify the IP routing table.
Route
33. ss
- Display socket statistics.
ss -s
https://cyberpublicschool.com
34. hostnamectl
- Control the system hostname and related settings.
hostnamectl status
35. resolvconf
- Manage DNS information.
resolvconf -u
36. iwconfig
- Configure a wireless network interface.
Iwconfig
37. nc
- Arbitrary TCP and UDP connections and listens.
nc -l 8080
38. scp CYBER PUBLIC SCHOOL
- Copy files between hosts on a network.
scp file.txt user@host:/path/to/destination
39. ssh-keygen
- Generate, manage, and convert authentication keys
for ssh.
ssh-keygen -t rsa
https://cyberpublicschool.com
40. ss
- Show socket statistics.
ss -t -a
41. tcpdump
- Capture and display packets on a network.
tcpdump -i eth0 tcp port 80
42. route
- Add a new route.
route add -net 192.168.2.0 netmask
255.255.255.0 gw 192.168.1.1
43. nmcli
- Command-line client for NetworkManager.
nmcli connection show
CYBER PUBLIC SCHOOL
44. dig
- Perform DNS lookups.
dig +short A google.com
45. nload
- Visual representation of incoming and outgoing
traffic.
Nload
https://cyberpublicschool.com
46. iperf
- Tool for measuring TCP and UDP bandwidth
performance.
iperf -c server_ip
47. fping
- Quickly ping multiple hosts.
fping -a -g 192.168.1.1 192.168.1.254
48. iftop
- Real-time console-based network bandwidth
monitoring tool.
iftop -n
49. route
- Delete a route.
CYBER PUBLIC
route del -net 192.168.2.0 netmaskSCHOOL
255.255.255.0
50. tcpdump
- Capture and display packets in ASCII.
tcpdump -A -i eth0
51. netcat
- Utility for reading from and writing to network
connections.
nc -zv 192.168.1.1 22
https://cyberpublicschool.com
52. nmtui
- Text User Interface for controlling NetworkManager.
Nmtui
53. ethtool
- Change the speed/duplex settings of an Ethernet
device.
ethtool -s eth0 speed 100 duplex full
54. ss
- Show listening sockets.
ss -l
55. host
- DNS lookup utility.
host google.com
CYBER PUBLIC SCHOOL
56. nmcli
- List available Wi-Fi networks.
nmcli device wifi list
https://cyberpublicschool.com
Contacts us
https://cyberpublicschool.com/
https://www.instagram.com/cyberpublicschool/
Phone no.: +91 9631750498 India
+61 424866396 Australia
CYBER PUBLIC SCHOOL
Our Successful Oscp Student.
https://cyberpublicschool.com