LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2018, 03:45 AM   #1
gracylayla
LQ Newbie
 
Registered: Aug 2018
Location: USA
Posts: 2

Rep: Reputation: Disabled
Frequently used Linux Networking Commands


1. netstat:

This command is used to display the contents of the /proc/net files. This command works with the Linux network subsystem and will let you know on the status of the ports if they are open, closed, waiting or masquerade connections. This provides various other information based on using the many options that these commands provide with.

2. tcpdump:

This is a sniffer command, basically a program that targets on capturing the packets of a networking interface and also does the interpretation of these for you. This command understands all the basic internet protocols and it can also be used to save the entire packets for inspection that can be always performed later.

3. ping:
This command derives its name after the sound of an active sonar system and performs a similar activity on a Linux networking system as well. This command is used to send echo requests to a host that we specify in conjunction with this command and further lists the responses that are received from the round trip time.

PING (Packet INternet Groper) command is the best way to test connectivity between two nodes. To stop a ping to a host, we may use the keyboard keys CTRL + C together to break it.

ping 10.76.56.16

Using ping /smbmount/ssh or any other UNIX system programs with a fully qualified domain name (FQDN) instead of an IP address will work out if and only if, these computers are listed in your /etc/hosts file or else it won’t.

4. hostname:
This command lets the system or network administrator know the hostname of the computer that they are logged into. This may sometimes be called as host as well.

5. traceroute:
This command is used to know the route of a packet. This command will list all the series of hosts through which the packets have gone through or traveled through on its way to the specified destination. There are many graphical equivalents to this command/program and one of such commands is xtraceroute.

Traceroute command usage can be as follows:
traceroute machine_name or ip

6. tracepath:
The command tracepath does a similar function to that of traceroute but differs mostly on the fact that the tracepath command doesn’t take complicated options.

tracepath machine_name or ip

7. findsmb:
The findsmb command is used to list down all the information about machines that do respond to the SMB name queries. To take an example, the windows based machines which share their hard disks.

This command will list down all possible machines and to control over the output that you see, you may want to specify a particular subnet to query upon to retrieve machines pertaining to it alone.

8. nmap:
This command is a very sophisticated network tool that is used to query for machines (either local or remote machines) to check whether they are UP and Running, and if so, on what ports are open on these machines. This command/tool can be safely understood as a network exploration tool and also a security scanner.

The command usage is pretty simple, as shown as below:

nmap machine_name

This would query on the machine name that is provided on what ports are kept open. nmap is a wonderful and the most powerful tool for which documentation is available on the nmap site itself.
 
Old 08-28-2018, 02:40 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I'd add lsof to that list and generally use it in place of netstat for everything but listing route table.

lsof -i @host : port

Where host is the IP or hostname and port is the port you want to examine for that host. You can do it without the @host if you just want to see what is using the port "lsof -i : port". You can also use lsof to specify the PID in which you're interested to see what connections it has: "lsof -p<PID> -i". Of course you can use "lsof -i" to see all hosts and ports.

lsof is "list open files" and had more uses beyond networking. I find it an invaluable tool for day to day troubleshooting and analysis.

Also tools such as "ifconfig" and "ip" for looking at interfaces configured and other information.

Tools like "ethtool" to look at settings (speed/duplex etc...) on interfaces as well as to change advertised settings for autonegotiation.
 
Old 08-28-2018, 02:55 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,735

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by gracylayla View Post
Using ping /smbmount/ssh or any other UNIX system programs with a fully qualified domain name (FQDN) instead of an IP address will work out if and only if, these computers are listed in your /etc/hosts file or else it won’t.
Nice summary of commands. Only one comment: FQDN's will also work in place of an IP address if the FQDN resolves via DNS. The Domain Name System's purpose is to retrieve the IP address for a domain name.
 
Old 08-29-2018, 12:17 PM   #4
DennyY
Member
 
Registered: May 2018
Location: San Francisco, CA
Distribution: CentOS 7
Posts: 85

Rep: Reputation: 1
Smile Frequently used Linux Networking Commands

Thank you for the summary!

May I add ifup and ifdown to enable/disable network interface.

Thanks again,
Denny




Quote:
Originally Posted by gracylayla View Post
1. netstat:

This command is used to display the contents of the /proc/net files. This command works with the Linux network subsystem and will let you know on the status of the ports if they are open, closed, waiting or masquerade connections. This provides various other information based on using the many options that these commands provide with.

2. tcpdump:

This is a sniffer command, basically a program that targets on capturing the packets of a networking interface and also does the interpretation of these for you. This command understands all the basic internet protocols and it can also be used to save the entire packets for inspection that can be always performed later.

3. ping:
This command derives its name after the sound of an active sonar system and performs a similar activity on a Linux networking system as well. This command is used to send echo requests to a host that we specify in conjunction with this command and further lists the responses that are received from the round trip time.

PING (Packet INternet Groper) command is the best way to test connectivity between two nodes. To stop a ping to a host, we may use the keyboard keys CTRL + C together to break it.

ping 10.76.56.16

Using ping /smbmount/ssh or any other UNIX system programs with a fully qualified domain name (FQDN) instead of an IP address will work out if and only if, these computers are listed in your /etc/hosts file or else it won’t.

4. hostname:
This command lets the system or network administrator know the hostname of the computer that they are logged into. This may sometimes be called as host as well.

5. traceroute:
This command is used to know the route of a packet. This command will list all the series of hosts through which the packets have gone through or traveled through on its way to the specified destination. There are many graphical equivalents to this command/program and one of such commands is xtraceroute.

Traceroute command usage can be as follows:
traceroute machine_name or ip

6. tracepath:
The command tracepath does a similar function to that of traceroute but differs mostly on the fact that the tracepath command doesn’t take complicated options.

tracepath machine_name or ip

7. findsmb:
The findsmb command is used to list down all the information about machines that do respond to the SMB name queries. To take an example, the windows based machines which share their hard disks.

This command will list down all possible machines and to control over the output that you see, you may want to specify a particular subnet to query upon to retrieve machines pertaining to it alone.

8. nmap:
This command is a very sophisticated network tool that is used to query for machines (either local or remote machines) to check whether they are UP and Running, and if so, on what ports are open on these machines. This command/tool can be safely understood as a network exploration tool and also a security scanner.

The command usage is pretty simple, as shown as below:

nmap machine_name

This would query on the machine name that is provided on what ports are kept open. nmap is a wonderful and the most powerful tool for which documentation is available on the nmap site itself.
 
Old 08-29-2018, 12:19 PM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,244

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
ipaddr (to get the IPv4 address) is quite useful too.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need UNIX/LINUX networking commands in detail ... arun17reddy Linux - Newbie 6 05-21-2010 03:15 AM
Basic Networking Commands maac_caam Linux - Networking 4 07-13-2006 01:05 PM
what are some good networking commands for linux/programs chiatello Linux - Networking 3 07-30-2003 09:39 PM
Where can I use some basic networking commands in linux? OrganicX Linux - Networking 9 12-17-2002 09:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration