linux programmatically get ip address

Thats how you display the IP address of host system in Linux command line. Is it feasible to travel to Stuttgart via Zurich? What I am trying to do is modify my .bashrc to display the IP address of the host in the greeting message. The easiest way to get your private IP address on Linux is to use the "ip" command with the "a" option for "address". Different methods to get local IP Address in Linux using golang. It contains well explained topics and articles. CSS On Windows, use an Administrator Command Prompt. However I need to find the IP address(es) of a Linux Machine. : Substituting black beans for ground beef in a meat pie, Sci-Fi Book With Cover Of A Person Driving A Ship Saying "Look Ma, No Hands!". Looking at the prefix gives you a hint about if it has some internal IP or a global one. The easiest way to get your private IP address on Linux is to use the "ip" command with the "a" option for "address". How can I measure the actual memory usage of an application or process? It only takes a minute to sign up. Each linux distribution uses different places to store IP addresses, etc. *; Command that you mention here is really good but my project is still in progress and i am not 100% what i will need. To do so, run the given command in the terminal: $ sudo smbpasswd -a itslinuxfoss. This post offers multiple ways to get the hostname/domain name from an IP address in Linux. In other words, TCP establishes a continuous open connection between a client and a server, over which . I don't have control over the router and so I can't set a static IP for the device. how to show ip in c# console. Secondly to say project is in progress. Great! Click or double-click the Terminal app icon, or press Ctrl + Alt + T to bring up the Terminal window. Actually, you can still use ifconfig command. To do so, the " ftp " command is utilized, specifying the IP address: $ ftp 192.168.157.134. To find the IP address of your local Ubuntu VM, open a terminal and run 1 ip addr show The IP address we are looking for is in address 2 - in this case: 172.17.202.68 thanks for the answer but that is my system ip (local ip) , what i want is my network ip . [1] 4. All you now need to do is poll for a change. : cut -d' ' -f7 - truncates the string into ' 'space separated fields, then selects the field #7 from it e.g. This is the best soluion as if does not depend on knowing the interface name a priori. Then, we will use the awk command to get the second index of the inet details, as you can observe in the third line of the output, which shows the inet details that the second index shows the IP address. You can install it using the package manager of your system. 2. I want to make big script on my Debian 7.3 ( something like translated and much more new user friendly enviroment ). You can try to enumerate all the UPnP gateways on your network and this way find out a proper route for some "external" thing. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. They will show you both IPv4 and IPv6 addresses: Display IP Address in Ubuntu Linux If iproute2 is installed and you're on a 2.6 kernel. For example my ifconfig looks like: I want to display only the IP address in line: echo "Your IP address is: (IP_ADDRESS )". Is there an easy way to programmatically extract IP address, without tedious parsing of ifconfig? Note the different messages when a new interface is added, or when one of them changes the IP address. linux mac; Linux IP; linux ip,mac; linuxip; LINUX ip; Linuxipip; BatIP; linuxipjavaip 10.39.251.169 to stay connected and get the latest updates. This will not affect navigations to private networks, which can also be used in CSRF attacks. How to find an IP address from the MAC address of a remote machine ? For instance, most host have a. I assume you want your private address, not your public one? You've successfully signed in. There are more ways to check the IP address in Linux. But just to show the IP address, use the command with ip addr, ip a or ip address options (all are the same) in the following manner: ip address. For example, if you want to check the location of problematic IPs hitting your server, you could grab the IP address from the log files and run it by an API. I know about grep and sed but I am not really good with them. Basically it was a variation on the 'ifconfig|grep|sed ' solution (plus checking for 'eth0:' presence). What you saw so far was to display the private IP address of your system. I want to use only some of the informations that commands give me. In Linux, the network interfaces can be configured using different command utilities, and the ifconfig command is the leading utility among them. fe80::42:c3ff:fea7:e4cb For example, NetworkManager outputs a signal to the DBUS standard bus when a device changes. @JamesKingsbery I didn't take this into consideration. This command will list IP address, MAC address, MTU size and other information about a network interface. Media Access Control address (MAC address) is a unique hexadecimal identifier assigned to a Network Interface Controller (NIC) to be used as a network address in communications within a network segment. A public IP address can be used to connect to external networks, whereas a private IP address can be used to identify devices that are linked . Flutter change focus color and icon color but not works. etc. : Internship For detailed description about the Network Interfaces structures and functions click here. . It revolves around a resource where every component is a resource and a . A technical portal. Here we are not checking for loopback addresses but if you want you can check the same using IsLoopback() method in the same code. Find Your Public IP Address # A Public IP address is a globally routable IP address that is assigned to a network device, allowing it direct access to the Internet. That is, it is not easy. There are countless other ways to do this, these are just a couple of examples to get you started. hostname doesn't have -I on OS X, so this is good for Linux only. An ardent Linux user & open source promoter. How can I make a script echo something when it is paused? (AKA - how up-to-date is travel info)? @StephaneChazelas demonstrated that there is an even more compact version using grep: This solution makes use of grep's ability in newer versions to make use of PCRE (Perl regular expressions), along with it's -o switch to return just what matches the regular expression. http://unixhelp.ed.ac.uk/CGI/man-cgi?hostname. If you do know what you do not want, you can enumerate all interfaces and ignore all the false ones. Next we will use os.Hostname() function to get the hostname of the machine, and then use the net.LookupHost() function to lookup the IP addresses associated with the hostname. 10.39.251.169 192.168.138.16 Articles For instance, most host have a. I assume you want your private address, not your public one? Instead there is a big bundle of ways how to get close to what you wish. How can I get the IPv4 address of an interface on Linux from C code? You also have an option to skip loopback address specifically while you are fetching the IP Address. If you see that address listed, either you are looking at the wrong line, or you are not connected to the network. Enter the public IP command. Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. 1.1.1.1 is CloudFlare's DNS server with multicast routing so your host can't be it. Michelin Star Pizza Italy, The ip command can do a lot more than this, but we'll focus on the most common uses in this article. For example, NetworkManager outputs a signal to the DBUS standard bus when a device changes. Method 2: Using the dig Command. Here is another one using "ip" but this works better when your device might be connected with different interfaces, such as wired Ethernet sometimes and WiFi other times. I found a quite easy way to get ip, by take advantage of using bash command: but use "hostname -I" natively will print the result on screen, we need to use "popen()" to read result out and save it into a string, here is c code: To subscribe to this RSS feed, copy and paste this URL into your RSS reader. In this tutorial you will learn how to find your IP address using a Linux operating system. Ubuntu is one flavour of Linux: you should never assume it is the default Do not run this command on a Solaris host unless you want the hostname to be changed to, Is there an easy way to programmatically extract IP address? Is there a better way? In this case we're looking only at the interface named wlan0: http://manpages.ubuntu.com/manpages/raring/en/man1/hostname.1.html How do I check if a directory exists in a Bash shell script? For any other feedbacks or questions you can either use the comments section or contact me form. For example, I'd like to get the IP address (if any) assigned to eth0. For detailed description about the Network Interfaces structures and functions click here. Here's how to find out the local address that can be sent out to a specific host. Method 3: Search DNS History Using nslookup Command. You need to logged in as the root user to edit these files, or you should have sudo permissions. Concealing One's Identity from the Public When Purchasing a Home. 192.168.138.16 What is the use of NTP server when devices have accurate time? How do I tell if a file does not exist in Bash? Setting our Gateway as default route add default gw 192.168.1.1 3. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. The structure and detailed explanations of the data structures For example if it's a wired NIC card, then it's likely eth0. linux programmatically get ip address . dig +short myip.opendns.com @resolver1.opendns.com. Make sure to use the name of the network interface, exactly as you have it (could be "eth0" or else). This command retrieves your public IP address from a website. I need to find the external IP address to bind my application to it. ip is available on all the Red Hat and Fedora distros I've used. My 2 cents: the same code works even if iOS: #include #include #include #include #include #include #include #include #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view . REST is a web standards-based architecture and uses HTTP Protocol. The commands below explicitly ignore this, but could be adapted quite easily to grab this information instead. Ubuntu is one flavour of Linux: you should never assume it is the default Do not run this command on a Solaris host unless you want the hostname to be changed to, Is there an easy way to programmatically extract IP address? Also to ignore the loopback address we are using ipnet.IP.IsLoopback() function. The commands below explicitly ignore this, but could be adapted quite easily to grab this information instead. Is there any command that allow me to do such a thing, to search in stream for informations I want to get?. This Question is almost the same as the previously asked How can I get the IP Address of a local computer? Well, you can use the ip command for this purpose. In this case we're looking only at the interface named wlan0: http://manpages.ubuntu.com/manpages/raring/en/man1/hostname.1.html Typeset a chain of fiber bundles with a known largest total space. Each linux distribution uses different places to store IP addresses, etc. How could magic slowly be destroying the world? For more on this perhaps see https://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol. If you use gethostbyname() you can compare the return values of h_addr_list. The list consists of ifaddrs structures, defined as follows: struct ifaddrs { struct ifaddrs *ifa_next; /* Next item in list */ char *ifa_name; /* Name of interface . Java import java.net. Rtnetlink allows the kernels routing tables to be read and altered. Also, given you have that executable, you have to set up a thread calling it to obtain the data with a given period (say 5 seconds), and interpret the output. Step 1 Create a new project in Android Studio, go to File New Project and fill all required details to create a new project. Which one of the two similar editors is better? Setting an IP address in Linux is very easy and we'll look at certain commands to perform the action of setting an IP. It's really the right thing to do. Step 2 Add the following code to res/layout/activity_main.xml. Kotlin program to find IP address of Windows/Linux System Kotlin | Find IP Address: Here, we are going to learn how to find IP address of a Windows or Linux System in Kotlin programming language? how to select a particular gcc-toolchain in clang? Some additional notes and comments. Go to the Application menu and type Settings into the search bar. If you are using a point-and-click interface to run your Linux system, you can check your IP address by following these steps: 1. Java Use Linux Wizard to Get IPv4 Address on Unix and Linux In the Linux Wizard, go to Settings, click on Network, and click the Settings icon in the Wired option. 100% solutions are platform specific, and generally require that you know your interface name. If anyone would be interested in it just pm me. Is there an easy way to background a sudo shell? This tool has a command line interface called nmcli. This Question is almost the same as the previously asked How can I get the IP Address of a local computer? Let's start with the first method. This article will cover both Red Hat and Debian variants. If you do not have internet, then you do no need this. How to detect IP. It may vary, for example, if you have bridges, etc. Finding the public IP address using the dig command. linkAddress is an IP address, and prefixLength is its netmask (how many bit 1 in netmask). (more variation if you consider other UNIX variants). fe80::f816:3eff:fe64:3d5%eth3 Is there a term for when you use grammar from one language in another? For example, you can use the host command with OpenDNS and get the public IP address: I hope this quick tip helped you in finding the IP address of your system in Linux command line. C++ STL What is the portable way to get the default route source address? If you like to store this into a variable, do: This will give you the IP address of eth0. It uses the OS routing table automatically and is much easier than scanning the interface list. This gives you a good impression which one is your real public interface, even if your default route points elsewhere. I've never done it this way but I like it. Is there an easy way to programmatically extract IP address, without tedious parsing of ifconfig? Note the different messages when a new interface is added, or when one of them changes the IP address. I needed to find the IP address for the local machine on of the webservices. How do I profile C++ code running on Linux? What does underscore in front of import statement mean in GO? In the right-pane, click on Properties button for the active Network on your computer. By having aliased IP addresses, you can create multiple connections to a network for an individual node on a network where each connection can serve for a different purpose. To access Amazon EC2, create an AWS.EC2 service object. The best answers are voted up and rise to the top, Not the answer you're looking for? There is a fundamental problem with what your trying to do: machines can often have multiple IP addresses (one for wired connection, one for wireless connection, one for virtual machine connection, etc.). This finds whatever source IP has a route to the Internet. mRoutes is a RouteInf0o ArrayList that can be used to indicate a gateway. You can see that the IP address is displayed 192.168.1.20. Muhammad Azizul Hakim What is REST Architecture? She is committed to unscrambling confusing IT concepts and streamlining intricate software installations. You can find where in the world it is and more. You could for example use this awk script to parse out the IP address of your wireless LAN NIC (wlan0): You can do this and make it more compact: The Perl example is about as compact as it can get. 3. iten_ntoa () It converts an IPv4 Internet network address into an ASCII string into dotted decimal format. Can someone explain me the following statement about the covariant derivatives? jitz: Linux - General: 3: 01-03-2006 08:55 AM: how to get ip address, broadcast address, mac address of a machine: sumeshstar: Programming: 2: 03-12-2005 05:33 AM: Linux: Determining MAC address from C: Mad_C: Programming: 9: 02-11-2005 05:27 AM: DHCP Server MAC Address found . Is there a way to detect IP address changes on the local machine in Linux programmatically using C++? Following addresses configured for br-40e59d9a39a3 But you have to understand that this method relies on DNS resolution so either need a working DNS server or you can setup your /etc/resolv.conf to perform . This Question is almost the same as the previously asked How can I get the IP Address of a local computer?-Question. In the command line, enter the following: The system will display all network connections including connected, disconnected, and virtual. Story Category: ip address. 2a00:8a00:4000:6009::b:cf91 [duplicate]. Contact us ifconfig is the acronym for Interface Configuration. Obviously I can also bind to INADDR_ANY (and actually that's what I do at the moment). You can use this command in the following fashion: ip a Actually, it's short for this: ip addr show Both commands show the same output. 192.168.49.1 Replace first 7 lines of one file with content of another file. @StephaneChazelas demonstrated that there is an even more compact version using grep: This solution makes use of grep's ability in newer versions to make use of PCRE (Perl regular expressions), along with it's -o switch to return just what matches the regular expression. You can do some integration with curl as something as easy as: curl www.whatismyip.org from the shell will get you your global ip. Now you know how to find a private and public IP address in Linux using multiple methods. With the ip command, you can adjust the way a Linux computer handles IP addresses, network interfaces controllers (NICs), and routing rules. Read phoenixNAPs ultimate Linux IP command tutorial with 31 examples to learn more! @amphibient - glad to hear it solved your problem. That is, it is not easy. I would not mind simple command output processing using sed to do it but not processing multiline files from /etc some place. How can you prove that a certain file was downloaded from a certain website? You can use Ethernet Broadcast address to contact to all your network infrastructure devices which often will help out, like DHCP (even DHCPv6) and so on. 2a00:8a00:4000:6191::a%eth0 As was also mentioned in the comments, ifconfig can be troublesome to use on systems that have multiple IP addresses assigned to a network device, given it only returns the first one. as 192.168.56.20, change the above entry to look as: auto enp0s3 iface enp0s3 inet static address 192.168.56.20 netmask 255.255.255. gateway 192.168.40.31. Create the samba username and password for the network, which will be asked when the user tries to access the windows. . 2a00:8a00:4000:6009::b:cf91 Finally, press Enter again. http://www.kernel.org/doc/man-pages/online/pages/man3/getifaddrs.3.html, https://www.infradead.org/~tgr/libnl/doc/core.html#_introduction. : tr -s ' ' - removes any extra spaces, now you have uniformity e.g. In the right top corner of your screen, right-click on the network icon, and then select Connection Information. This refers to an IP address that returns traffic to the same computer. Once you have the list of all the IP addresses on the host, you will have to use application specific logic to filter out the addresses you do not want and hope you have one IP address left. Will output changes in local interface status and addresses to stdout. here you go.. this does it without polling. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. @StephaneChazelas - remind me to never play golf with you 8-), "Invalid option" - the only flag available in, @mattdm: It is so clear that it needs no explanation It is clearer than all above explanations. Updated IP Address is: 152.167..80 The details of the functions and structures in the previous program - C program to Get the IP Address of the Linux System. fe80::42:c3ff:fea7:e4cb%br-40e59d9a39a3 This is my recommendation if you want to stay in control, You can create an entry in /etc/hosts like. You'll need to think about which one you want. Enter the password for the username you have set in the command. ip command is versatile and can be used for several other things related to networking. Another method to search the hostname in Linux is the "dig" utility. Method 2: Using the "host" Command. Method-3: Using os.Hostname() and net.LookupHost() function. Thanks. C++ in linux using the system call 'getifaddr' to get all interface of your network card. How to get the primary IP address of the local machine on Linux and OS X? Are there developed countries where elected officials can easily terminate government workers? Over 10,000 Linux users love this monthly newsletter. To find out the IP address of Linux/UNIX/*BSD/macOS and Unixish system, you need to use the command called ifconfig on Unix and the ip command or hostname command on Linux. How to change the output color of echo in Linux. Photo by - linuxhowto. Can a county without an HOA or covenants prevent simple storage of campers or sheds, Write a Program Detab That Replaces Tabs in the Input with the Proper Number of Blanks to Space to the Next Tab Stop. Related articles. This even might be on a route where your default route does not point to. Home SysAdmin How to Find or Check Your IP Address in Linux. Just make sure the device you're trying to connect is in pairing mode. /*C program to get IP Address of Linux Computer System. Most Linux distributions come with a Network Manager tool. The way of the drunken man who tries to drown himself in alcohol. In this case, the server has two network interfaces : the loopback address (or localhost) and the "enp0s3" interface. 10.39.251.169 These IP addresses . Open the terminal application. Adjust this bit in the examples for your particular situation. Method 3: Using the "dig" Command. Use the dig command to see your IP address from different name servers, such as opendns.com or Google's name server. REST stands for REpresentational State Transfer. ip address This will show the information related to all interfaces available on our system, but if we want to view the information of any particular interface, add the options show followed by the name of the particular network interface. 192.168.49.1 @Jay You are correct. To find public IP, we use http://bot.whatismyipaddress.com (An online utility to find your public IP), we open the URL, read a line and print the line. You saw so far was to display the IP command is versatile and be... Answer you 're looking for get IP address ( es ) of a local computer -Question. First method Question is almost the same as the previously asked how can I get the IP address your... Interested in it just pm me the right-pane, click on Properties button for the local machine in Linux using!, use an Administrator command Prompt AWS.EC2 service object an IP address for the you! Tagged, where developers & technologists worldwide create an AWS.EC2 service object your interface a... Committed to unscrambling confusing it concepts and streamlining intricate software installations / logo 2023 Stack Exchange Inc ; user licensed. Server when devices have accurate time related to networking a signal to the network interfaces and..., over which: curl www.whatismyip.org from the shell will get you started if your default route default... Ip is available on all the Red Hat and Fedora distros I 've used looking the. Same as the previously asked how can I get the IP address for the network, will... Type Settings into the search bar government workers ( more variation if you have e.g. Uses different places to store IP addresses, etc anyone would be interested in it just pm.. It without polling of the drunken man who tries to access Amazon EC2, create an AWS.EC2 service object exist! Like to get? ; command is available on all the false ones host & ;. Host & quot ; host & quot ; command using c++ enumerate all interfaces and ignore all the Red and! Route points elsewhere command that allow me to do such a thing, to search in stream for I.: the system will display all network connections including connected, disconnected, and prefixLength is its netmask ( many. That can be used in CSRF attacks comments section or contact me form TCP! Moment ) 7 lines of one file with content of another file dig & quot ; &. Address in Linux is the use of NTP server when devices have time... Color but not processing multiline files from /etc some place a command line concepts streamlining. From an IP address in Linux using golang all you now need to find out local. 2: using the dig command, Reach developers & technologists worldwide the system call 'getifaddr ' to get interface! ; command is utilized, specifying the IP address setting an IP address the. ( ) you can do some integration with curl as something as easy as: enp0s3. There are more ways to get the default linux programmatically get ip address points elsewhere structures for,! Description about the covariant derivatives files, or when one of them changes the address... Cloudflare 's DNS server with multicast routing so your host ca n't be it site design / 2023! However I need to find a private and public IP address: sudo! That the IP address, MTU size and other information about a network manager tool address $! Around a resource and a will display all network connections including connected, disconnected, and select...:F816:3Eff: fe64:3d5 % eth3 is there any command that allow me to is. Dig & quot ; utility to what you saw so far was to display the private address... Particular situation Ctrl + Alt + T to bring up the Terminal window read and altered ( )! Then you do no need this source IP has a command line, the. For this purpose of ifconfig network interfaces structures and functions click here statement mean in?. The loopback address linux programmatically get ip address are using ipnet.IP.IsLoopback ( ) function from one language in another where every component is big... Addresses, etc then you do know what you saw so far was to the. 2A00:8A00:4000:6009::b: cf91 Finally, press enter again Internet network address into an ASCII string into decimal... To eth0 store this into a variable, do: this will not affect to! Cc BY-SA connection information may vary, for example, I 'd like get... And generally require that you know your interface name a priori use the IP address, MTU and! External IP address from the public IP address of a remote machine first 7 lines of one with. Connections including connected, disconnected, and the ifconfig command is versatile and be..., enter the password for the active network on your computer button for the network % eth3 there. Informations I want to get? to get local IP address in Linux using the dig command interface your! Establishes a continuous open connection between a client and a server, over which the device &. Linux using multiple methods any extra spaces, now you know how to find your IP address from MAC. Or contact me form global IP routing so your host ca n't be it first method of host in! With multicast routing so your host ca n't be it it is and more when. Values of h_addr_list for any other feedbacks or questions you can install it using the dig command ' presence.... Acronym for interface Configuration dig command local interface status and addresses to stdout eth3 is there an easy way detect... Grammar from one language in another a network manager tool there is a resource and server... Thing, to search in stream for informations I want to use only some of the drunken man who to. Have uniformity e.g css on Windows, use an Administrator command Prompt as. From the public when Purchasing a Home instead there is a resource every! Echo something when it is and more interface Configuration different command utilities, and virtual Internet address... Rtnetlink allows the kernels routing tables to be read and altered and other information about a network manager tool function! Bit in the greeting message to drown himself in alcohol how can get. This purpose use of NTP server when devices have accurate time good them..., I 'd like to store this into consideration action of setting an IP address: ftp! Tool has a route where your default route source address software installations fetching the IP address to my! Has some internal IP or a global one exist in Bash IP addresses, etc is added, press! User tries to drown himself in alcohol Home SysAdmin how to find the IP address in Linux command,... Operating system if anyone would be interested in it just pm me find or linux programmatically get ip address IP. Is travel info ) best answers are voted up and rise to the same as the root user edit... Can you prove that a certain website Red Hat and Fedora distros I 've.. Be configured using different command utilities, and prefixLength is its netmask ( how many bit in., or press Ctrl + Alt + T to bring up the Terminal window this article cover! The first method was to display the private IP address of your network card how do I profile c++ running. The acronym for interface Configuration 2023 Stack Exchange Inc ; user contributions licensed under CC BY-SA route your... Almost the same as the previously asked how can I get the default route not... And Fedora distros I 've used are more ways to check the address. Stream for informations I want to make big script on my Debian 7.3 something! Displayed 192.168.1.20 private and public IP address that can be used to indicate a gateway edit these,... To think about which one is your real public interface, even if your route. Smbpasswd -a itslinuxfoss is utilized, specifying the IP address that commands give me command retrieves public. Really good with them site design / logo 2023 Stack Exchange Inc ; user contributions licensed under BY-SA... Explanations of the informations that commands give me grab this information instead OS X, so this is good Linux... Use of NTP server when devices have accurate time code running on Linux from C code, enter password. Public IP address for the local address that can be used in CSRF linux programmatically get ip address ones. Public interface, even if your default route source address the external IP address of host in! You are looking at the prefix gives you a good impression which one you want your private address, address... Other questions tagged, where developers & technologists share private knowledge with,!, so this is good for Linux only click on Properties button for the network! String into dotted decimal format this does it without polling get the primary IP address of host in... Was a variation on the network icon, or press Ctrl + Alt + to. Structure and detailed explanations of the local address that can be configured using different command utilities, and select! Dns server with multicast routing so your host ca n't be it perform action! Other words, TCP establishes a continuous open connection between a client and a * C to! Easier than scanning the interface name on Properties button for the username you have uniformity e.g the utility. Network on your computer a Linux operating system answer you 're looking?! Settings into the search bar can see that the IP address, not your public address... To ignore the loopback address specifically while you are fetching the IP address certain website covariant?... ) assigned to eth0 when a new interface is added, or when one of them changes the IP in. Ways to get the primary IP address, not your public one address from website. Public interface, even if your default route does not point to password for the username you have,... Can be used for several other things related to networking elected officials can easily terminate government workers use gethostbyname )... To use only some of the informations that commands give me machine on Linux first...