get last state change from ova-file

Category: SW linux one-liner

Posted at 2021-03-21.



lastStateChange of VirtualBox Appliance (.ova)




VirtualBox allows appliances (virtual machines) to be exported. A file with the extension .ova is generated.

These exported appliances can also be used for file backups, as they are already prepared for an import into a possibly different environment. (See also blog article on rsync.)

Now the time at which the virtual machine was last worked on does not have to be the same as the time at which the VM was exported. Especially if - for whatever reason - you have two or more .ova files with the same name, you generally want to do not know which export was created last, but you want to know which one contains the latest program version, i.e. when was the status of the VM last changed. Unfortunately, VirtualBox doesn't tell you that easily. Not even if you open the file for import.

Fortunately, you can get the info directly from the file. e.g. for the file u_ee01.ova:


cat u_ee01.ova | tar xOf -  --wildcards "*".ovf | sed -n  -e 's/^.*lastStateChange=\"\(.*\)\".*$/\1/p'

Send us your Comment

... because software matters