Site icon LinuxAndUbuntu

10 Essential Linux Network Commands

10 Essential Linux Network Commands

10 Essential Linux Network Commands

Hello folks, today let’s take a look at some 10 essential Linux network commands. These commands may be used to configure, to troubleshoot your network or to obtain some more information all via the terminal in Linux. So let’s go!  

10 Essential Linux Network Commands

1. Ping (Packet Internet Groper)

PING command sends packet requests to the address you specify to test the connectivity between 2 nodes.

Note that the ping command will keep executing unless you ping with -c option to exit after N number of requests.

2. Netstat

Netstat command displays different information including open sockets and routeing tables. Run netstat command alone to see a list of open sockets. Netstat has a ton of opitons.

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.

3. Tcpdump

Tcpdump captures packets off a network interface and interprets them for you. It can be used to save entire packets for later inspection.

4. Host

Command to find 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.

5. Tracepath

Tracepath traces 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. It can be very handy when trying to determine the points of slowness in your connection path.

6. Ifconfig

This command is used to display IP Address, Hardware and MAC address. It is also used configure network interfaces. You can use it to activate or deactivate interfaces, assign an IP Address to the interface.

a. Ifdown

Use ifdown device-name/interface name to bring an interface down by following a script (which will contain your default networking settings). Simply type ifup and you will get help on using the script.

​For example typing: ifdown eth0 Will bring eth0 up if it is currently down.  

b. ifup

Use ifdown device-name to bring an interface up by following a script (which will contain your default networking settings). Simply type ifup and you will get help on using the script.

For example typing: ifup eth0 ​Will bring eth0 up if it is currently down.  

7. Route

The route command is the tool used to display or modify the routeing table.

You may add or delete routes or add a default gateway with the following commands. route add -net 10.10.10.0/24 gw 192.168.0.1
route del -net 10.10.10.0/24 gw 192.168.0.1
route add default gw 192.168.0.1  

8. Nslookup

This command is used to find DNS related query.

9. Dhclient

Use this command to release (-r option) your IP address and get a new one from your DHCP server.

10. Whois

This is a just a few of the very many useful networking commands for Linux. Share in the comments, some other basic networking commands not in this list. Thanks for reading. A whois query for LinuxAndUbuntu will go something like this –

So in the same way this command will give you information for other domains. Yeah! You can pass google domain. 🙂

Conclusion

So these are the 10 essential Linux network commands. There are tons of more left for you to explore. You can practice these commands so that you can master them and execute when need to. You can also comment your favorite Linux network commands in the comment section below. Enjoy!

Exit mobile version