The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,751 other followers

Archive for the ‘bash’ Category

use vmrun – via How do I find the IP address of a virtual machine using VMware Fusion? – Super User

Posted by jpluimers on 2017/04/20

Note this works only when the VMs have VMware Tools installed (more on that below):

VMWare provides, not surprisingly, a built in tool for this, vmrun. It’s under /Applications/VMware Fusion.app/Contents/Library/vmrun although it has moved around in other Fusion releases a bit.

🍺 vmrun list Total running VMs: 1 .docker/machine/machines/myvm.vmx
🍺 vmrun getGuestIPAddress ~/.docker/machine/machines/myvm.vmx 172.16.213.128

via: How do I find the IP address of a virtual machine using VMware Fusion? – Super User [WayBack]

vmrun [WayBack] is barely documented and most of is in PDF of which this is the most recent I could find: www.vmware.com/pdf/vix180_vmrun_command.pdf [WayBack]

Based on the above path, I added this to my ~/.bash_profile file:

alias vmrun='/Applications/VMware\ Fusion.app/Contents/Library/vmrun'
alias vmrun-list-running-VMs='vmrun list | grep vmx'
vmrun-list-ipv4-of-running-VMs()
{
  vmrun-list-running-VMs | while read line ; do echo $line && vmrun getGuestIPAddress $line; done
}

Now I can do this:

$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.135
/Users/jeroenp/VM/diaspore-opensuse-Tumbleweed-x64.vmwarevm/diaspore-opensuse-Tumbleweed-x64.vmx
Error: The VMware Tools are not running in the virtual machine: /Users/jeroenp/VM/diaspore-opensuse-Tumbleweed-x64.vmwarevm/diaspore-opensuse-Tumbleweed-x64.vmx
$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/diaspore.opensuse-Tumbleweed-x64/diaspore.opensuse-Tumbleweed-x64.vmx
Error: Unable to get the IP address
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.135
$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/diaspore.opensuse-Tumbleweed-x64/diaspore.opensuse-Tumbleweed-x64.vmx
Error: Unable to get the IP address
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.135
$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/diaspore.opensuse-Tumbleweed-x64/diaspore.opensuse-Tumbleweed-x64.vmx
172.16.172.134
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.135
$ vmrun-list-ipv4-of-running-VMs
/Users/jeroenp/VM/diaspore.opensuse-Tumbleweed-x64/diaspore.opensuse-Tumbleweed-x64.vmx
172.16.172.134
/Users/jeroenp/VM/W81Entx64DelphiRegression.vmwarevm/W81Entx64.vmx
172.16.172.142

These are the messages I observed:

Error: The VMware Tools are not running in the virtual machine: /Users/jeroenp/VM/diaspore-opensuse-Tumbleweed-x64.vmwarevm/diaspore-opensuse-Tumbleweed-x64.vmx
Error: Unable to get the IP address
172.16.172.135

The first one means a machine is running but has no VMware Tools installed. For an OpenSuSE machine you can install it with zypper install open-vm-tools, for other Linux systems read VMware Tools auf Ubuntu, Mint, CentOS oder openSUSE installieren | ITrig [WayBack]

Some more examples of vmrun for VMware Fusion are at Control VMware Fusion from the Command Line | James Reuben Knowles [WayBack]

–jeroen

Posted in *nix, bash, Development, Fusion, openSuSE, Power User, Scripting, Software Development, SuSE Linux, Tumbleweed, Virtualization, VMware | Leave a Comment »

Bash that JSON (with jq) — Librato Blog

Posted by jpluimers on 2017/04/18

 Glueing together APIs requires working with JSON: parsing it, extracting it, transforming it. JQ is a fast, lightweight, flexible, CLI JSON processor, that does the job well. Learn how to use it by getting your hands dirty with a JSON blob that represents the open issues in the public Docker GitHub repository.

Source: Bash that JSON (with jq) — Librato Blog [WayBackhttp://blog.librato.com/posts/jq-json

via: http://blog.librato.com/posts/jq-json – Joe C. Hecht – Google+

–jeroen

Source: http://blog.librato.com/posts/jq-json

Posted in bash, Development, JavaScript/ECMAScript, JSON, Scripting, Software Development | Leave a Comment »

.bashrc generator: create your .bashrc PS1 with a drag and drop interface

Posted by jpluimers on 2017/04/13

Cool: .bashrc generator: create your .bashrc PS1 with a drag and drop interface

http://bashrcgenerator.com/

–jeroen

http://bashrcgenerator.com/ – Joe C. Hecht – Google+

Posted in bash, Development, Scripting, Software Development | Leave a Comment »

Getting your local IPv4 addresses, netmasks and CIDRs

Posted by jpluimers on 2017/04/11

In order to scan some local networks for unknown hosts (yes, on some sites you need to perform archeology), I needed the local IPv4 addresses, netmasks and CIDRs on my Mac running OS X.

Part of that is using ifconfig to get local inet information which however uses hexadecimal network masks and delivers no CIDRs.

SoI was a bit premature when I wrote about “This could be done by creating bash functions mask2cdr and cdr2mask, but that’s a bit too convoluted right now” in Getting the IP addresses of gmail MX servers – via Super User – dig isn’t enough.

netmask to CIDR and CIDR to netmask conversion

I need mask2cdr now, so lets start with these two bash functions and their aliases:

Read the rest of this entry »

Posted in *nix, *nix-tools, Apple, bash, Development, OS X, OS X El Capitan, OS X Maverick, OSX Yosemite, Power User, Scripting, Software Development | Leave a Comment »

Some great StackOverflow / StackExchange bash tips

Posted by jpluimers on 2017/04/06

Found these then trying to create a new feature for https://github.com/Hexxeh/rpi-update:

–jeroen

Posted in bash, Development, Scripting, Software Development | Leave a Comment »

 
%d bloggers like this: