Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6693667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:00:36+00:00 2026-05-26T06:00:36+00:00

How can i get only IP and which interface IP it is? So that

  • 0

How can i get only IP and which interface IP it is? So that i can keep a record file such as realtime.ini

1 – test.sh

#!/bin/bash
ipstring ='inet (.*)'

for i in $(ip addr);
do
        echo $i #on found it write down to my realtime.ini as a list for future query
done

2 – realtime.ini

em1,192.168.1.2
lo,127.0.0.1
wlan0,<not found>

Follow up: Just for single ip:
$ ifconfig eth0 | grep ‘inet addr:’ | cut -d: -f2 | awk ‘{ print $1}’
192.168.1.2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:00:37+00:00Added an answer on May 26, 2026 at 6:00 am

    This is not terribly elegant, nor is bash, but you can do the following if you have both awk and sed:

    ifconfig | awk 'BEGIN { FS = "\n"; RS = "" } { print $1 $2 }' | sed -e 's/ .*inet addr:/,/' -e 's/ .*//'
    

    I wouldn’t bet on this being hugely portable either, so maybe someone has a better answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can we get the values of the radio buttons , only those which has
How can I get only unique departments from the below example? Dept Id Created
How can I get and set the 'read-only' property of an edit box?
How can I get superscript done, only in CSS? I have a stylesheet where
example: at this domain http://www.example.com/234234/go.html is only one iframe-code how can i get the
Logging can get complicated, quickly. Considering that you have some code, how do you
TL;DR Summary: I need a single command-line application which I can use to get
Can get all triples with value null in specific field? All people with date_of_birth
I can get easily see what projects and dlls a single project references from
I can get both System.Net.Mail and System.Web.Mail to work with GMail, but I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.