Basic Networking command in Linux/Unix

linux commands

Basic networking commands

Basic networking commands (such as tracert, traceroute, ping, netstat, ipconfig, hostname, tcp dump and nslookup) . And their arguments, options and parameters in details including how they are used to troubleshoot the computer network.

networking command of unix/linux

Ifconfig: -Getting network configuration.

  • Ifconfig stands for “interface configuration” .
  • One of the most basic networking commands is ifconfig.
  • View network configuration, it displays the current network adapter configuration. It is handy to determine if you are getting transmit (TX) or receive (RX) errors.
  • It will tell you about your network interfaces, the state that they’re in, your assigned IP address, and even provides some counts of packets that have crossed the interface since the system was last booted. These days, you may see both ipv4 and ipv6 addresses.
  • The RX (receive) and TX (transmit) packets counts as well as the same basic statistics shown in bytes.
  • These numbers may seem huge, but the system was running for roughly a year.
ifconfig command

Ping: -Test network connection.

  • The ping command sends an echo request to a host available on the network.
  • Using this command, you can check if your remote host is responding well or not.
  • Tracking and isolating hardware and software problems.
  • Determining the status of the network and various foreign hosts.
  • Testing, measuring, and managing networks.
  • Syntax: –Following is the simple syntax to use the ping command − $ping hostname or IP-address. The above command starts printing a response after every second.
  • Example: -$ping google.com

Netstat: -Network connections, routing tables, interface statistics.

  • The netstat command can tell you about ongoing connections on the local system and ports (i.e., services) that are listening, indicating that services are waiting for requests to come through.
  • By itself, netstat gives you a lot information. With –a option, it gives you even more.
netstate command

Traceroute: – routing steps it takes to reach the remote host

  • A handy utility to view the number of hops and response time to get to a remote system or website is traceroute. Again, you need an internet connection to make use of this tool.
  • The traceroute command will attempt to provide a list of all the routers your connections, cross when reaching out to a remote system.
  • The output also provides some information on how long each segment of the path takes, thus giving you some notion of the quality of a connection.
  • If traceroute gets to aa point at which it is unable to provide further information, you will start to see asterisks where you used to see system names and timing.
traceroute command

Nslookup: – Query DNS lookup name.

  • If you know the IP address it will display hostname.
  • To find all the IP addresses for a given domain name, the command nslookup is used.
  • You must have a connection to the internet for this utility to be useful,
  • Example: –   $ nslookup blogger.com
nslookup command

Hostname: – finding host/domain name and IP address.

  • Generally, you know the name of the system you’re logged into.
  • Here are some hostname command options that you might not be using.
  • Example: –
  • hostname with no option displays the machine’s hostname.
  • hostname -d displays the domain name the machine belongs to.
  • hostname -f displays the fully qualified host and domain name.
  • hostnamei displays the IP address for the current machine. The –i option provides and easy way to grab the system’s IP address without having to separate it from it ifconfig output.

whois

  • You can often find a lot more information about a domain using the whois command,
  • Example; – $ whois valero.com.
  • It is queried and response protocol.
who command

tcpdump

Type of packet analyzer software utility  that monitors and logs tcp/IP traffic between network and computer.

The tcpdump command can print out the headers of network packets as they reach your server or can be used with various filters to select just the packets you want to see.

Install using install tcpdump.

  • Capture packets from specific interface
    tcpi eth0 :Display available interfaces
    Tcpdump –d :Read captured packets in file
    Tcpdump –r abc.pcap :Capture packets from ip source
    Tcpdumpi eth0 src 192.168.0.2
                               

You can also refer basic commands in linux by clicking below.

1 thought on “Basic Networking command in Linux/Unix

Leave a Reply