In our Previous Linux guide, I mentioned the best Tips and Tricks for Linux and review of Linux application. Now in this guide, I am going to discuss the best essential & useful Linux network commands list. If you are looking for the useful Linux network commands list then you at right place and I going to give you the best reason and ways to use listed Linux network commands. Here you will also get the best Linux Network Commands cheat sheet.
Listed commands are also useful Linux network troubleshooting cheat sheet. Many of them are also best Linux network configuration command line. These Linux network configuration commands are going to help you in set up your network in best ways. Even they also protect you from hacking. Maintaining of system and network up and running is a task of System / Network Administrator’s job.
Read More:- List of Top Windows Run Commands: You should know.
List of Essential & Useful Linux Network Commands.
ifconfig (interface configurator)
This command is used to show your network configuration IP Address, Hardware and MAC address and also MTU (Maximum transmission unit) size. It is also used to configure network interfaces enable or disable interface on demand.
Enable or Disable Specific Interface
Follow the commands to Enable or Disable specific interface.
Enable ( ifup )
# ifup eth0
Disable ( Ifdown )
# ifdown eth0
Setting MTU Size
By default MTU size is 1500. You can set required MTU size with below command by replacing XXXX with size.
# ifconfig eth0 mtu XXXX
Read More:- Top Useful CMD Commands You Should Know.
PING (Packet Internet Groper)
This command sends packet requests to the address you specify to test the connectivity between 2 nodes. Whether it is Local Area Network (LAN) or Wide Area Network (WAN). Ping uses ICMP (Internet Control Message Protocol) to communicate to other devices. You can ping hostname of IP address using the command below.
# ping teletrickmania.com PING teletrickmania.com (107.154.161.140): 56 data bytes 64 bytes from 107.154.161.140: icmp_seq=0 ttl=46 time=506.855 ms 64 bytes from 107.154.161.140: icmp_seq=1 ttl=46 time=729.998 ms Request timeout for icmp_seq 2 64 bytes from 107.154.161.140: icmp_seq=2 ttl=46 time=1363.267 ms 64 bytes from 107.154.161.140: icmp_seq=3 ttl=46 time=769.473 ms 64 bytes from 107.154.161.140: icmp_seq=4 ttl=46 time=788.485 ms 64 bytes from 107.154.161.140: icmp_seq=5 ttl=46 time=1626.689 ms 64 bytes from 107.154.161.140: icmp_seq=6 ttl=46 time=1046.970 ms 64 bytes from 107.154.161.140: icmp_seq=7 ttl=46 time=649.618 ms 64 bytes from 107.154.161.140: icmp_seq=8 ttl=46 time=669.029 ms
Note:- The ping command will keep executing unless you ping with -c option to exit after N number of requests.
NETSTAT (Network Statistic)
Netstat has a ton of options. This command is used to display connection info including open sockets and routeing tables. Add the option -r to display information on the routeing table. Add the option -p to display information of programs connected to the open sockets.
# netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.50.1 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 0 0 0 eth0 default 192.168.50.2 0.0.0.0 UG 0 0 0 eth0
Read More:- How To Kill or Monitor Running Process Tasks Using Command Prompt in Windows
NSLOOKUP
This command is used to find DNS related query.
# nslookup teletrickmania.com Server: 2405:200:800::1 Address: 2405:200:800::1#53 Non-authoritative answer: Name: teletrickmania.com Address: 107.154.168.140
Whois
This is a very useful Linux networking command. It shows some details about the domain which is in public.
Domain Name: TELETRICKMANIA.COM Registry Domain ID: 2032254957_DOMAIN_COM-VRSN Registrar WHOIS Server: whois.fastdomain.com Registrar URL: http://www.fastdomain.com Updated Date: 2017-05-25T07:26:34Z Creation Date: 2016-05-30T12:46:14Z Registry Expiry Date: 2018-05-30T12:46:14Z Registrar: FastDomain, Inc. Registrar IANA ID: 1154 Registrar Abuse Contact Email: Registrar Abuse Contact Phone: Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited Name Server: NS1.BLUEHOST.COM Name Server: NS2.BLUEHOST.COM DNSSEC: unsigned
Tcpdump
It captures packets off a network interface and interprets them for you. It can be also used to save entire packets for later inspection. Tcpdump also needs admin permission.
Read More:- Hide your private files and folder using the command prompt.
Host
This command helps you to find the name to IP or IP to name in IPv4 or IPv6 and also query DNS records. Give it a domain name and you’ll see the associated IP address. Give it an IP address and you’ll see the associated domain name.
# host www.google.com.in Host www.google.com.in not found: 3(NXDOMAIN) Aashirvads-MacBook-Air:~ aashirvad$ host www.google.in www.google.in has address 172.217.163.131 www.google.in has IPv6 address 2404:6800:4008:c01::5e
Tracepath
It helps to trace the path of the network to the destination you have provided. It attempts to list the series of hosts through which your packets travel on their way to a given destination. Tracepath can be very handy when trying to determine the points of slowness in your connection path.
ARP (Address Resolution Protocol)
This is a is used to view/add the contents of the kernel’s ARP tables. To see default table use the command as.
# arp -e Address HWtype HWaddress Flags Mask Iface 192.168.50.1 ether 00:50:56:c0:00:08 C eth0
Read More:- 15+ Best Free Android Hacking Learning Apps or Tutorial Apps.
ETHTOOL
It is used to view, setting speed and duplex of your Network Interface Card (NIC). You can set duplex permanently in /etc/sysconfig/network-scripts/ifcfg-eth0 with ETHTOOL_OPTS variable.
# ethtool eth0 Settings for eth0: Current message level: 0x00000007 (7) Link detected: yes
IWCONFIG
This Linux command is used to configure a wireless network interface. You can see and set the basic Wi-Fi details like SSID channel and encryption. You can refer man page of iwconfig to know more.
# iwconfig [interface]
HOSTNAME
Run hostname command to see the hostname of your box. You can set hostname permanently in /etc/sysconfig/network. Need to reboot box once set a proper hostname.
# hostname teletrickmania
Read More:- Best Linux Distros for Beginners and Learners of 2018.
Route
The route command is the tool used to display or modify the routeing table.
# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.50.0 * 255.255.255.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 1002 0 0 eth0 default 192.168.50.1 0.0.0.0 UG 0 0 0 eth0
system-config-network – GUI Tool
Type system-config-network in command prompt to configure network setting and you will get nice Graphical User Interface (GUI) which may also use to configure IP Address, Gateway, DNS etc.
# system-config-network
Dhclient
Use this command to release (-r option) your IP address and get a new one from your DHCP server. This command needs admin permission.
Read More:- 5+ Free Best WiFi Hotspot Software as Best WiFi Connectivity Alternative.
Closing Words
These are the useful and essential Linux network commands which are helpful in many cases. These commands are basic Linux network commands which help you to many things on your PC. Many of the advance commands are available for doing many tasks and getting more information about the network. Many of the commands are also helpful in MAC & Windows. You can also comment your favorite Linux network commands in the comment section below.