# Creating an IP Lookup with one line

Make a file called public-ip.sh

```bash
sudo nano public-ip.sh
```

Copy this:

```bash
#!/bin/bash
# dig command to lookup what the public ip address is

dig +short myip.opendns.com @resolver1.opendns.com
```

Make it executable:

```bash
sudo chmod +x public-ip.sh
```

Run the file and it will output your current public IP:

```bash
./public-ip.sh
```