[Solved] Get Linux version and name
Posted
#1
(In Topic #1095)
Enthusiast

Just out of curiosity is there a way in Gambas to get it to display on a label what Linux it is running on and what version the kernel is?
For example I have Debian 12 on my PC's and on my about screen I would like to show something like
"this app is running on Debian 12 (kernal 6.1.0-9-amd64) please let our support people know if you have to call us"
Can this be done with Gambas?
Posted
Regular

Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Guru

Output: -
Operating System: Linux Mint 21.2
Kernel: Linux 5.15.0-84-generic
Posted
Enthusiast

cogier said
I thought that this was an interesting question. As a result, I discovered that all distros that use Systemd, and that is most distros now, have a useful command called hostnamectl. This produces quite a bit of interesting information. The following code will return the information you are looking for: -
Output: -
Operating System: Linux Mint 21.2
Kernel: Linux 5.15.0-84-generic
Hi
Just a update the above it works well but on my system I had to change it from System to Operating
Posted
Enthusiast

AndyGable said
cogier said
I thought that this was an interesting question. As a result, I discovered that all distros that use Systemd, and that is most distros now, have a useful command called hostnamectl. This produces quite a bit of interesting information. The following code will return the information you are looking for: -
Output: -
Operating System: Linux Mint 21.2
Kernel: Linux 5.15.0-84-generic
Hi
Just a update the above it works well but on my system I had to change it from System to Operating
Posted
Guru

AndyGable said
cogier said
I thought that this was an interesting question. As a result, I discovered that all distros that use Systemd, and that is most distros now, have a useful command called hostnamectl. This produces quite a bit of interesting information. The following code will return the information you are looking for: -
Output: -
Operating System: Linux Mint 21.2
Kernel: Linux 5.15.0-84-generic
Hi
Just a update the above it works well but on my system I had to change it from System to Operating
Really?
hostnamectl | grep System does not work for you?
Posted
Enthusiast

BruceSteers said
AndyGable said
cogier said
I thought that this was an interesting question. As a result, I discovered that all distros that use Systemd, and that is most distros now, have a useful command called hostnamectl. This produces quite a bit of interesting information. The following code will return the information you are looking for: -
Output: -
Operating System: Linux Mint 21.2
Kernel: Linux 5.15.0-84-generic
Hi
Just a update the above it works well but on my system I had to change it from System to Operating
Really?
hostnamectl | grep System does not work for you?
No not on Debian 12
Posted
Regular

I modified the code in my suggestion above.AndyGable said
I have Debian 12 on my PC
Can you test it with your Debian 12 ?
Thank you.
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Guru

AndyGable said
BruceSteers said
AndyGable said
Hi
Just a update the above it works well but on my system I had to change it from System to Operating
Really?
hostnamectl | grep System does not work for you?
No not on Debian 12
It's working fine on my debian 12
How about this…
Code
lsb_release -ds 2>/dev/null; uname -sr
Debian GNU/Linux 12 (bookworm)
Linux 6.1.0-12-amd64
Or with gambas…
Posted
Regular

/comp/gb/system - Gambas Documentation
Seems it can tell you it is Linux, but not what exact distro and version of Linux.
1 guest and 0 members have just viewed this.


