The Most Useful Linux Commands For Network And Systems Administrators

The Most Useful Linux Commands For Network And Systems Administrators

Linux is a powerful and versatile operating system that powers many of the world’s servers and networks. As a network or system administrator, you need to master a variety of Linux commands that can help you configure, maintain, troubleshoot, and optimize your network and system performance. In this article, we will introduce some of the most crucial Linux commands for network and system administrators, such as ip, netstat, nmap, tcpdump, and more. We will explain what these commands do, how to use them, and why they are important for your daily tasks. By the end of this article, you will have a better understanding of Linux networking commands and how to use them effectively.

1. ifconfig: Used to display network interface information.

# ifconfig -a

2. ip: Used to show/manipulate routing, devices, policy routing, and tunnels.

# ip address show

3. route: Used to display or manipulate the IP routing table.

# route -n
# route add default gw 192.168.1.1
# route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
# route del -net 192.168.2.0 netmask 255.255.255.0

4. ping: Used to send ICMP ECHO_REQUEST to network hosts.

# ping techjunction.co
# ping 4.2.2.2

5. traceroute: Used to print the route packets take to reach a network host.

# traceroute techjunction.co
# traceroute 4.2.2.2

6. netstat: Used to print active network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

# netstat -an | more

7. ss: Used to display socket statistics.

# ss -tulpn | more
# ss -s
# ss -t -a
# ss -l

8. hostname: Used to show or set the system’s host name.

# hostname

9. dig: DNS lookup utility.

# dig techjunction.co a
# dig techjunction.co ns
# dig techjunction.co mx
# dig +short A techjunction.co

10. nslookup: Used to query internet name servers interactively.

# nslookup techjunction.co
# nslookup

11. iptables: An administration tool for IPv4 packet filtering rules, forwarding, and NAT.

# iptables -L

12. tcpdump: Used to capture sample network traffic for analysis and troubleshooting.

# tcpdump -i ens224
# tcpdump -i ens224 tcp port 80
# tcpdump -A -i ens224

13. service: Used to start|stop|restart or check running status of a Linux service or daemon

# service httpd start
# service httpd status
# service httpd restart
# service httpd stop

14. telnet: Can be used to test connection to a port on a remote host

# telnet techjunction.co 80

15. scp: Secure Copy (Used to transfer files securely to a remote host).

# scp filename.txt username@remote_host_ip:/remote_host_dir

16. wget: Used to download files from the internet (Non-interactive).

# wget https://techjunction.co/file.zip

17. curl: Is a CMD tool for transferring data to or from a server using various network protocols, e.g. HTTP, HTTPS, FTP, etc. It is useful for downloading files, testing endpoints, and debugging.

# curl https://techjunction.co/api

18. iptraf: Is a Linux tool for monitoring and analyzing network traffic. It can provide detailed information about incoming and outgoing traffic, as well as a graphical representation of the data. Used to diagnose network problems, optimize performance, and monitor security.

# apt install iptraf-ng
# apt update
# iptraf

19. iftop: is a Linux tool for monitoring and analyzing network traffic. It can provide detailed information about incoming and outgoing data packets flowing through a network interface and display the total bandwidth usage.

# apt install iftop
# apt update
# iftop -i eno1
# iftop -n

20. nmap: Is a Linux tool for network exploration and security auditing. It is used for various purposes, such as scanning for open ports and discovering vulnerabilities in a network.

# apt install nmap
# apt update
# nmap -v -A scanme.nmap.org
# nmap -v -sn 192.168.0.0/16 10.0.0.0/8
# nmap -v -iR 10000 -Pn -p 80

21. lsof: is a command-line tool for listing open files in Linux. It can show you various types of files that are opened by different processes, such as regular files, directories, sockets, pipes, etc. It can also provide detailed information about each file, such as the process ID, the user, the file descriptor, the size, and more.

# lsof
# lsof -i :80

22. ethtool: Is a Linux tool for managing network interface devices. It can display and modify the parameters of the devices, such as speed, duplex, link modes, driver information, and more. It can also help diagnose network problems and optimize performance.

# ethtool ens224
# ethtool -s eth0 speed 100 duplex full

23. arp: Used to display or modify the ARP cache.

# arp -a

24. hostnamectl: Used to display the system hostname and related settings.

# hostnamectl status

25. mtr: MTR (My Traceroute) is a Linux tool for network exploration and security auditing. It combines the functionality of both the traceroute and ping commands, by sending packets to a remote host and displaying the network path and performance. It can help diagnose network problems, identify potential bottlenecks or failures, and optimize performance.

# mtr techjunction.co

26. iwconfig: Used to configure a wireless network interface.

# iwconfig

27. ncat: (or netcat) is a command-line tool for reading and writing data across network connections, using the TCP or UDP protocols. It’s used for scanning ports and testing network connectivity.

# ncat techjunction.co 8080
# ncat -l 8080
# ncat --exec "/bin/bash" -l 8081 --keep-open
# ncat -zv 192.168.1.1 22

28. ssh-keygen: Generate, manage, and convert authentication keys for ssh.

# ssh-keygen -t rsa

29. nmcli: Is a command-line tool for managing and configuring network connections on Linux systems. It can create, modify, and delete network connections, and display and control the status of network devices and connections.

# nmcli
# nmcli connection show
# nmcli dev down ens193
# nmcli dev up ens193

30. nload: Linux tool used to monitor network traffic and bandwidth usage in real time

# nload

31. iperf: A Linux tool used for measuring TCP and UDP bandwidth performance. Can be used to identify bottlenecks in the network.

# iperf -c server_ip

32: fping: Used to quickly ping multiple hosts.

# fping -a -g 192.168.1.1 192.168.1.254

33: nmtui: Text User Interface utility for controlling NetworkManager.

# nmtui

34: host: DNS lookup utility.

# host techjunction.co

JoshuaProfile

About the Author

Joshua Makuru Nomwesigwa is a seasoned Telecommunications Engineer with vast experience in IP Technologies; he eats, drinks, and dreams IP packets. He is a passionate evangelist of the forth industrial revolution (4IR) a.k.a Industry 4.0 and all the technologies that it brings; 5G, Cloud Computing, BigData, Artificial Intelligence (AI), Machine Learning (ML), Internet of Things (IoT), Quantum Computing, etc. Basically, anything techie because a normal life is boring.

Spread the word:
Tech Junction Ltd © 2023 | Call: +256 775 088 973 | WhatsApp: +256 782 212 595 | Email: info@techjunction.co | Address: Plot 16, Robert Mugabe Rd, Mbuya, Kla, UG
Proudly powered by WordPress | Theme: Refined Magazine by Candid Themes.