DEV Community

0xkoji
0xkoji

Posted on

Let's Create Own Simple Command 002

Sometimes we want to know our global IP address. Actually, we can check with googling ip address, but why need to open Chrome for that???
(I guess most people are using Chrome for something while they are working, but still need to open a new tab)

Step 1 Create bash/zsh file

$ cd
$ mkdir .sh <-- if you don't have this
$ vim gip.sh
Enter fullscreen mode Exit fullscreen mode
#!/usr/bin/env zsh
curl http://checkip.amazonaws.com/
Enter fullscreen mode Exit fullscreen mode

Step 2 Add a new alias

.zshrc

alias gip="~/.sh/gip.sh"
Enter fullscreen mode Exit fullscreen mode

Step 3 Test

test

$ gip

111.111.111.111 <-- you will see your global ip address
Enter fullscreen mode Exit fullscreen mode

Top comments (0)