Linux networking commands

Linux is one of the most famous and widely used open-source operating systems. It is a clone of UNIX, but it's free to download and use, whereas UNIX is not. Despite being an open-source OS, it is secure and robust in its architecture, and many people, as well as organizations, rely upon it. Interestingly, you can create a Linux version of your own. You can do that by merely downloading Linux and making changes as you want. Essentially, we can identify them as different versions of Linux. Some of these versions are popular, e.g. Fedora, Debian, Linux Mint, Ubuntu, etc. These versions are also known as distros. The reason behind the extensive use of LINUX is that it is an open-source OS with the security and stability of the highest level.

Where is it used?

● Software development

● Embedded systems

● Servers

● Smartphones

● Supercomputers

● LAMP

The use of LINUX is so widespread that about 80 percent of smartphones across the globe and 90 percent of internet servers extensively use Linux.

Go through the Linux Course in HKR Trainings to get a clear understanding of Linux Network Commands!

What are Linux networking commands?

The Internet is nothing but a platform to exchange information of all sorts in all formats through the use of various systems. For the efficient exchange of information, there needs to be a network connecting them. Networking is a broad term that includes both networking within a particular network and networking across the entire internet. A network can be as simple as a home or office network and as complicated and complex as the one designed for a whole university, a space station, or the entire internet for that matter.

Troubleshooting and configuration are two essential components of a networking system. Here, we'll talk about the networking commands in Linux.

1. Linux ss:

This command is similar to netstat in the matter of the fashion of displaying information. Hence, it is also known as a new netstat. You can utilize the command line of ss command to get the stats for various domain sockets viz. UDP, DCCP, TCP, RAW, Unix, etc. Further, this command helps you to retrieve information regarding the communication of your Linux system with other systems, machines, networks as well as services. Following are details obtained by the ss command:

  • Stats regarding the networking protocol
  • Network and Linux socket connections

Syntax: ss [options] [filter]

Example:

Command: ss DST 216.58.216.184

Use: To know the mode of connection of the machine with the mentioned IP address with your Linux system. It displays the netid, network statistics, the local as well as remote IP port of the socket linked to the IP address 216.58.216.18

2.Linux Host command:

This command in Linux helps to find the information about the IP address of a specific domain name or vice versa. There are multiple options available for use along with this command through which one can get detailed information about any domain. This command is particularly used to perform a lookup of the DNS (Domain Name System).

Syntax: The general syntax of Host command is {[-aCdlriTWV] [-c class] [-N ndots] [-t type] [-W time] [-R number] [-m flag] hostname [server]}

Example:

Command: $ host google.com

Use: To get the IP addresses associated with the domain name.

3.Linux whois command:

Using this command, one can find out information related to a domain such as the information related to the owner of the domain and his/her contact details, the servers connected to specific domains, etc. This is a tool that works on the principle of queries and responses. The base of this tool is the TCP platform. The server of this command takes up the queries through port number 43. This allows the storage and delivery of the response in a human-understandable format.

Syntax:

a. General syntax: whois [-h Host] [-p Port] [-aCFH1LMmrRSVx] [-g SOURCE: FIRST-LAST] [-i ATTR] [-s Source] [-T TYPE] object

b. Modified syntax:

whois –v TYPE

whois –q keyword

Etc.

Example:

Command: whois educationculture.com

Output: A whois query on the domain name

Linux Certification Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project-Based Learning

4.Linux curl or wget command:

Curl and wget are the command line interfaces used to download files from the internet. Both commands support HTTPS along with HTTP. They also support FTP and SFTP. The curl and wget commands are also used to test the newly launched URLs on the website against already existing URLs.

Syntax:

curl – o

wget

Example

Command:

  • curl –o javapoint.com/linux-curl-and-wget
  • wget javapoint.com/linux-curl-and-wget

Output:

You can use both the commands to download the file. The wget command downloads the file and saves it as index.html.

Want to know Linux from Scratch, visit here Linux Tutorial 

5.Linux tracepath command:

This command traces back the network path of the destination mentioned in the command. In instances where you are experiencing a slow or weak network, this command can help you to determine the spots that are responsible for the slow network. Unlike traceroute, the tracepath command does not require any user privileges.

Syntax:

Tracepath

Tracepath [-nc] [/port]

Tracepath [other options like –t, -b, etc.]

Example

Command: tracepathwww.javaendpoint.com

Output: This command displays the TTL of the probe followed by the address of the local host followed by the miscellaneous RTT values. 

6.Linux ifconfig command:

The command ifconfig simply means interface configuration. It can perform multiple tasks right from the initialization of the interface to assignment of IP address, deleting, adding, or controlling an IP address, etc. Commonly, Linux users use this command to enable or disable any network interface.

Syntax:

  • General syntax: ifconfig
  • For getting the details of specific interface: ifconfig [eth0/lo/wlan0]
  • To assign IP address: ifconfig eth0 netmask
  • For enabling an interface: ifup eth0
  • For disabling an interface: ifdown eth0
  • For setting the size of MTU: ifconfig eth0 MTU

Example:

Command: ifconfig google.com down

Output: The command deactivates the driver of the interface google.com

Subscribe to our youtube channel to get new updates..!

7.Linux dig command:

This command can fire queries for DNS servers. Here, the dig is an abbreviation to Domain Information Groper. One can verify or troubleshoot the problems related to DNS through this command. It is also used to perform lookup operations for DNS. The command replies to the queries related to the name server added along with the commands. One can find this tool in the majority of the LINUX distributions.

Syntax: dig

Example:

Command: dig google.com.

Output: The output starts with the display of the installed version of dig followed by the global options. The further output displays the technical information related to the domain. Further displayed are the question, answers, and other additional sections.

8.Linux ip command:

This command as a replacement of the configure command serves many purposes. You can get information about the configured interface on the system through this command. Secondly, the command can trace the status of the query and you can also use it for Ethernet as well as IP address configuration. There are several other uses of this command like setting up or deleting the routing entry, displaying the cache entries, getting information about IP addresses, management, and display of the current network positions, etc.

Syntax: ip [options] [object] command

Example:

Command: ip –s –s –n –f 261.84.261.91

Output: The command flushes ARP entry of the given IP address

9.Linux mtr command:

The mtr here stands for my traceroute. It is a combination of ping and tracepath commands. This cross-system command displays the entire path travelled by the network packets, right from the source to the destination. The command also displays the amount of response and response time taken by all the network hops in the entire path. There are various options available with this command. For example, the use of -b option is to view the hostnames as well as numerical IP address, and the use of -c option is to set a limit on pings, etc.

Syntax: mtr [option]

Example:

Command: $ mtr –m 60 216.18.216.32

Output: Specifies the number of network hops between the source and the destination within the last 60 seconds.

Linux Certification Training

Weekday / Weekend Batches

10. Linux ifplugstatus command:

This command helps the user to know about the plugin status of a cable in the network interface of the user. This command-line is not installed in Ubuntu. The user can install it by using the command sudo apt-get install ifplugd. This command supports all the APIs along with the WLANs. This command has multiple flags used to perform varied functions.

Syntax: ifplugstatus

Example:

Command: @VeeFix : $ ifplugstatus

Output: The output displays the status of plugins installed and it also displays the plugins that are not installed on the domain. If the output says 'link beat detected', the plugin installation is successful.

11.Linux mtr command:

The mtr here stands for my traceroute. It is a combination of ping and tracepath commands. This cross-system command displays the entire path travelled by the network packets, right from the source to the destination. The command also displays the amount of response and response time taken by all the network hops in the entire path. There are various options available with this command. For example, the use of -b option is to view the hostnames as well as numerical IP address, and the use of -c option is to set a limit on pings, etc.

Syntax: mtr [option]

Example:

Command: $ mtr –m 60 216.18.216.32

Output: Specifies the number of network hops between the source and the destination withing last 60 seconds.

12.Linux ifplugstatus command:

This command helps the user to know about the plugin status of a cable in the network interface of the user. This command-line is not installed in Ubuntu. The user can install it by using the command sudo apt-get install ifplugd. This command supports all the APIs along with the WLANs. This command has multiple flags used to perform varied functions.

Syntax: ifplugstatus

Example:

Command: @VeeFix : $ ifplugstatus

Output: The output displays the status of plugins installed, and it also displays the plugins that are not installed on the domain. If the output says 'link beat detected', the plugin installation is successful.

13.Linux nslookup command:

You can get answers to the queries related to DNS using this command. You can also use it to get the following details:

  • IP address of specific systems
  • Domain related MX records
  • Domain related NS servers

It can work in both interactive as well as non-interactive modes.

Syntax:

  • For interactive mode: nslookup
  • For non-interactive mode: nslookup

Example:

Command: nslookup optimetrix.com

Output: The output displays the name of the host server along with its numeric IP address

14.Linux ping command:

This command is mainly used to identify and troubleshoot connectivity faults. This command sends single or multiple ICMP packets of echo requests to the target destination IP address. After this, it waits for the reply that the destination reverts back through an ICMP echo packet. Thus, you can check the activity of any system using this command.

Syntax: ping [options]

Example:

Command: $ ping informationtech.com

Output: If the IP is active, the output fields appear on the screen

15.Linux ARP command:

ARP is an abbreviation for Address Resolution Protocol. This command displays the cache data of the kernel's IP address. Using this command, one can add, delete, or display the entries in the kernel's table. To install arp on a Linux system, the user needs to type 'sudo apt-get update'.

 Syntax: arp [objects] [command]

Example:

Command: arp

Output: This command displays the network card details along with the connectivity of Ethernet.

16.  Linux iwconfig command:

This command is similar to ifconfig, but it only works with wireless network interfaces. Using this command, one can view as well as configure the basic details related to wireless network viz. the SSID, encryptions, frequency, etc. You can also use it to display the specifications along with wi-fi stats. There are various options available along with this command for extracting different information related to wireless networks.

Syntax: iwconfig [option] "name of the network"

Example:

Command: iwconfig eth0 nickname "Nodal Linux."

Output: This command assigns nicknames to the concerned wireless station. But you can use it with only a few wireless diagnostic tools.

17.Linux netstat command:

Here, netstat means network statistics. One can get the following details about a particular network using this command:

  • Open sockets statistics
  • Network table routing
  • Network connection statistics
  • Network interface statistics

You can also use this command to troubleshoot the issues related to the network.

Syntax: netstat [options]

Example:

Command: netstat –at

Output: List of all the ports related to TCP

Command: netstat –au

Output: List of all the ports related to udp

Conclusion:

The list of Linux commands mentioned above can efficiently solve your problems related to networking and the functions related to connectivity. If you are working with a Linux system, there are many such networking commands available for better networking. Each command has several options for performing specific functions. Install the command-lines related to these commands and the commands will be ready to use for better networking on your Linux system.

Request for more information

Webinar

Python tutorial for beginners

5th April | 08:00 AM

150 Registered

Mudassir
Mudassir
DevOps ERP and IAM tools
Mudaasir is a programming developer for hkr trainings. He has a well knowledge of today’s technology and I’ve loved technology my entire life. And also been lucky enough to work for the programmer including science and technology. Big thanks to everyone who has followed me on LinkedIn and twitter.

WhatsApp
To Top