Linux Admin & Network Commands: Essential Guide (2024)

Introduction:
Linux administration and networking are critical skills for IT professionals. This comprehensive guide covers essential commands for system administration and network management in Linux environments. Whether you’re a beginner or looking to refresh your knowledge, these commands will help you effectively manage Linux systems and networks.

  1. sudo
    Explanation: Executes a command with superuser privileges.
    Example:
sudo apt-get update
  1. systemctl
    Explanation: Controls the systemd system and service manager.
    Examples:
systemctl start apache2
systemctl status ssh
  1. journalctl
    Explanation: Queries the systemd journal.
    Example:
journalctl -u nginx.service --since today
  1. useradd / userdel
    Explanation: Adds or deletes user accounts.
    Examples:
sudo useradd -m newuser
sudo userdel -r olduser
  1. passwd
    Explanation: Changes user passwords.
    Example:
sudo passwd username
  1. chown
    Explanation: Changes file ownership.
    Example:
sudo chown user:group file.txt
  1. chmod
    Explanation: Modifies file permissions.
    Example:
chmod 755 script.sh
  1. ip
    Explanation: Shows and manipulates routing, devices, policy routing and tunnels.
    Examples:
ip addr show
ip link set eth0 up
ip route add 192.168.1.0/24 via 192.168.0.1
  1. ss
    Explanation: Another utility to investigate sockets.
    Example:
ss -tuln
  1. ping
    Explanation: Sends ICMP ECHO_REQUEST to network hosts.
    Example:
ping -c 4 google.com
  1. traceroute
    Explanation: Prints the route packets trace to a network host.
    Example:
traceroute google.com
  1. netstat
    Explanation: Displays network connections, routing tables, interface statistics.
    Example:
netstat -tuln
  1. nmap
    Explanation: Network exploration tool and security scanner.
    Example:
nmap -p 1-65535 192.168.1.1
  1. tcpdump
    Explanation: Dumps traffic on a network.
    Example:
tcpdump -i eth0 port 80
  1. iptables
    Explanation: Administration tool for IPv4 packet filtering and NAT.
    Examples:
sudo iptables -L
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  1. ifconfig
    Explanation: Configures a network interface (older command).
    Example:
ifconfig eth0
  1. iwconfig
    Explanation: Configures a wireless network interface.
    Example:
iwconfig wlan0
  1. hostname
    Explanation: Shows or sets the system’s host name.
    Examples:
hostname
hostname new-server-name
  1. dig
    Explanation: DNS lookup utility.
    Example:
dig google.com
  1. nslookup
    Explanation: Queries Internet name servers interactively.
    Example:
nslookup google.com
  1. route
    Explanation: Shows / manipulates the IP routing table.
    Example:
route -n
  1. mtr
    Explanation: A network diagnostic tool combining ping and traceroute.
    Example:
mtr google.com
  1. nc (netcat)
    Explanation: Reads and writes data across network connections.
    Examples:
nc -l 1234  # Listen on port 1234
nc 192.168.1.1 1234  # Connect to host on port 1234
  1. curl
    Explanation: Transfers data from or to a server.
    Example:
curl https://api.example.com
  1. wget
    Explanation: Retrieves files using HTTP, HTTPS, and FTP.
    Example:
wget https://example.com/file.zip
  1. arp
    Explanation: Manipulates the system ARP cache.
    Example:
arp -a
  1. ethtool
    Explanation: Queries or controls network driver and hardware settings.
    Example:
ethtool eth0
  1. rsync
    Explanation: Efficiently transfers and synchronizes files.
    Example:
rsync -avz /source/ /destination/
  1. top
    Explanation: Displays and updates sorted information about processes.
    Example:
top
  1. df
    Explanation: Reports file system disk space usage.
    Example:
df -h

Conclusion:
Mastering these Linux admin and networking commands is crucial for effective system management and troubleshooting. Regular practice and exploration of these commands will greatly enhance your Linux administration skills. Remember to always refer to the man pages (using the man command) for detailed information on each command, as functionality may vary slightly between different Linux distributions and versions.

Note: Many of these commands, especially those related to system configuration and network settings, require root or sudo privileges to execute. Always use caution when running commands with elevated privileges, as they can significantly impact system operation.