Let's learn about few networking side command in Linux/Unix
Tags: linux, archlinux, bash, unix
Published: 2021-06-26 16:33:39

Hi There!
I was working on few network side commands. I thought to share this with you all😃. Here you go ✌️

**1. netstat:**
*netstat* stands for Network Statistics. This is very basic command used to print network connections, routing tables, interface statistics etc.

![netstat details example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s26k88eneb7ioiuza899.png)

**Syntax**:
```
netstat [OPTIONS]
```
There are various options which are supported by **netstat** command. Listing few of them in below

* netstat -i: *i* stands for *Interface*.(Network Interface shows that how kernel links up with the software network side to the hardware network side).

**Example:**
![netstat -i example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm3scpw0pexhymk53jl7.png)

* netstat -r: *r* stands for [Routing](https://en.wikipedia.org/wiki/Routing). It will show kernel IP routing tables.

**Example:**
![netstat -r example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mx8acwzklx55x8zld4u.png)

**2. nslookup:**
**nslookup** stands for *Name Server lookup*. It helps us to check the IP address mapped to DNS(Domain Name System) and vice versa. This is very useful when we want to troubleshoot the DNS related issue.

![nslookup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9c5ildqmhblwsi9yppft.png)

**Syntax**:
```
nslookup [OPTIONS]
```

**nslookup** has two modes *Interactive* and *Non-Interactive*.

* **Interactive Mode:** When we have various hosts and domains then we should use this mode.

**Example:**

![nslookup interactive mode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84o3by8urljq40yo9pjd.png)

* **Non-Interactive Mode:** We can use this for single host or domain.

**Example:**
![nslookup non-interactive mode](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vmh5d8oud6jmg4qaoiop.png)


**3. ping:**
**ping** stands for **Packet Internet or Inter-network Grouper**. This command send a echo request to host network and when host network receive the request, it send an echo response through [Internet Control Message Protocol(ICMP)](https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol)

![ping command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q3cvn7uu4v3grrwocmi9.png)

**Syntax**:
```
ping [OPTIONS]
```

* **ping -i:** *i* stands for *Interval*. Interval second between sending each packet.The default waiting interval sec is 1 sec while sending packet. We can customise that using this command.

**Example:**
![ping interval](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u8jrwmn2grinxmb0f4zx.png)

* **ping -w:** Here *w* means deadline. How many packets do you want to send as request and get response. This command can help to number of packets delivery and automatically will be stopped once it is completed.

**Example:**
![ping deadline](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tb27vgl0aylyacev46jp.png)

**4. curl:**
*curl* is used to transfer data to or from server using most of the protocols(HTTP,HTTPS,FTP,SMTP,TELNET etc).

![Curl description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r8w2do9nlp6is8v0s5zw.png)

**Syntax**:
```
curl [OPTIONS]
```
`Note: we can use multiple options together. we will be seeing these in below examples`

* **curl -o:** *o* stands for *output*. We can write the output to a file.

**Example:**
![curl output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f85ctczhim7rroqm5fht.png)

* **curl -s:** *s* stands for *silent*. WE can use it when we don't want to see the progress bar.

**Example:**
![curl s](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/js53flev3mznywjajwc9.png)

* **sending email:** Use the below commands we can send the email. 
*Note: If you have are using gmail and you have enabled 2 steps authentication google will not allow you to do that from non-Google app. You might get the security alert 🔒 from google.*

**Example:**
![Sending email through curl](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lgc3rowqe58j3p1ugl5x.png)

mail.txt has below details:
![curl mail.txt file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9s07s077y0we46oox8k7.png)

**5. ssh:**
**ssh** stands for **Secure Shell**. It is used for logging into the remote machine and execute the commands on remote machine.

**Syntax**:
```
ssh [OPTIONS]
```

**ssh -i**: *i* stands for *identity file*. It selects a file for public key authentication.🔐


**Example:**
It will connect to remote ubuntu server.

![ssh i](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0enp9plby4n9qz3lyf5.png)

**server_key:** This is the public key of the server
**ubuntu:** Server name
**34.208.206.133:** server ip address.

```
Note: For every command do man <command> and <command> --help for more info
```
Hope you like this articles🥰,I would love to connect on [GitHub](https://github.com/PayalSasmal10) [Twitter](https://twitter.com/payalsasmal) [Linkedin](https://www.linkedin.com/in/payal-sasmal-64204311a/)