Jump to content
Not connected, Your IP: 3.142.98.111
knifegunaxe

echo server name in command line

Recommended Posts

hi, I use this command to display the name of the connected server in bash:
 

wget -q -O - '$@' https://airvpn.org | grep -e 'Connected to'| sed 's|^[^g]*g| |' | sed 's/<.*//' | sed s'| >||'
It is working, but maybe someone can write it better...

Share this post


Link to post

Pull the userinfo API endpoint with curl, filter with jq.

$ curl -H "API-KEY:…" "https://airvpn.org/api/userinfo/"|jq .connection.server_name

API key is in your API settings.

NOT AN AIRVPN TEAM MEMBER. USE TICKETS FOR PROFESSIONAL SUPPORT.

LZ1's New User Guide to AirVPN « Plenty of stuff for advanced users, too!

Want to contact me directly? All relevant methods are on my About me page.

Share this post


Link to post

Thanks. Here is what I use now:
 

curl --silent 'https://airvpn.org/api/whatismyip/' | grep server | sed 's|^[^\:]*\:| |' | sed 's|,||' | sed 's| ||'

Share this post


Link to post

A possible alternative:

curl -s 'https://airvpn.org/api/whatismyip/' | awk '{ FS = "\"" } /server/ { print $4 }'

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image

×
×
  • Create New...