Linux Networking Commands New
Linux Networking Commands New
Every computer is connected to some other computer through a network whether internally
or externally to exchange some information. This network can be small as some computers
connected in your home or office, or can be large or complicated as in large University or
the entire Internet.
ss It is a replacement of netstat.
Linux ifconfig
The command ifconfig stands for interface configurator. This command enables us to
initialize an interface, assign IP address, enable or disable an interface. It display route and
network interface.
You can view IP address, MAC address and MTU (Maximum Transmission Unit) with ifconfig
command.
A newer version of ifconfig is ip command. ifconfig command works for all the versions.
Syntax:
1. ifconfig
Look at the above snapshot, it shows the IP address of all three that is eth, lo and wlan.
1. ifconfig eth0
2. ifconfig lo
3. ifconfig wlan0
Assigning IP address and Gateway
You can assign IP address and Gateway to an interface but these settings will be disabled
after system reboot.
Syntax:
1. ifdown eth0
Linux ip
This is the newer version of ifconfig command.
Syntax:
1. ip a or ip addr
To get details of specific interface
To find IP address of all three differently, use command
1. ip a show eth0
2. ip a show lo
3. ip a show wlan0
Linux traceroute
The traceroute command is a network troubleshooting utility which helps us to determine
number of hops and packets travelling path required to reach a destination.
Note: If you don't have traceroute utility installed in your system, use the following
command to install it,
1. traceroute <destination>
Exmaple:
1. traceroute javatpoint.com
Linux tracepath
It is similar to traceroute command, but it doesn't require root privileges. By default, it is
installed in Ubuntu but you may have to download traceroute on Ubuntu. It traces the
network path of the specified destination and reports each hop along the path. If you have a
slow network then tracepath will show you where your network is weak.
Syntax:
1. tracepath <destination>
Exmaple:
1. tracepath javatpoint.com
Look at the above snapshot, path to the javatpoint.com is being traced by the tracepath
command.
Linux ping
The ping command stands for (Packet INternet Groper). It checks the connectivity
between two nodes that is whether a server is reachable or not.
ping command keep executing and sends the packet until you interrupt.
1. ping <destination>
Example:
1. ping javatpoint.com
ping using IP address
You can use IP address also with ping command.
Example:
1. ping 2.2.2.2
Syntax:
1. ping -c 5 javatpoint.com
Look at the above snapshot, packets are limited to 5 without pressing keys.
Linux netstat
The netstat command stands for Network Statistic. It displays information about different
interface statistics including open sockets, routing tables and connection information.
Syntax:
1. netstat
netstat -s
It displays detiled statistics for all ports.
netstat -r
This command displays routing table information.
Linux ss
The ss command is a replacement for netstat command. This command gives more
information in comparison to the netstat. It is also faster than netstat as it gets all
information from kernel userspace.
Syntax:
1. ss
Look at the above snapshot, ss command displays all TCP, UDP and socket connections.
1. ss -ta
2. ss -ua
3. ss -xa
Syntax:
1. ss -lt
2. ss -lu
3. ss -lx
Linux dig
The dig command
stands for
Domain
Information
Groper.
To find record This
for a particular domain use dig command followed by the domain name.
command is used
for task related to
Syntax:
DNS lookup to
query DNS name
1. dig <domainName>
servers. It mainly
deals with
troubleshoot DNS
related problems.
Look at the above snaphsot, it displays domain name in the answer section.
Linux nslookup
This command is also used to find DNS related query.
Syntax:
1. nslookup <domainName>
Example:
1. nslookup javatpoint.com
Look at the above snapshot, it displays the record information of javatpoint.com
Linux route
The route command displays and manipulate IP routing table for your system.
A router is a device which is basically used to determine the best way to route packets to a
destination.
Syntax:
1. route
Look at the above snapshot, it displays all existing routing table entries on our system.
It shows that if the destination is within the network range of 10.0.0.0 to 10.0.0.255, then
the gateway is *, which is 0.0.0.0. This is a special address which represents an invalid or
non-existent destination.
Packets which are not within this IP range, will be forwarded to default gateway, which
further routes the packet.
Displaying numerical IP address
This command displays output in full numerical form.
Syntax:
1. route -n
Syntax:
Syntax:
1. route -Cn