We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a documented method for a Bash script to detect if it's running on "Ubuntu on Windows" vs native Ubuntu?
It looks like grepping /proc/version for the string "Microsoft" would work, but it could potentially have false positives.
"Microsoft"
For reference, these are the contents of /proc/version on my machines:
Linux version 3.4.0-Microsoft ([email protected]) (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Wed Dec 31 14:42:53 PST 2014
Linux version 4.4.0-31-generic (buildd@lgw01-16) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1) ) #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016
My Windows build number: Microsoft Windows [Version 10.0.14393]
Microsoft Windows [Version 10.0.14393]
The text was updated successfully, but these errors were encountered:
I would suggest /proc/sys/kernel/osrelease
Duplicate of #423
Sorry, something went wrong.
Thank you!
How about uname -r which does the same thing?
uname -r
No branches or pull requests
Is there a documented method for a Bash script to detect if it's running on "Ubuntu on Windows" vs native Ubuntu?
It looks like grepping /proc/version for the string
"Microsoft"
would work, but it could potentially have false positives.For reference, these are the contents of /proc/version on my machines:
Linux version 3.4.0-Microsoft ([email protected]) (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Wed Dec 31 14:42:53 PST 2014
Linux version 4.4.0-31-generic (buildd@lgw01-16) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1) ) #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016
My Windows build number:
Microsoft Windows [Version 10.0.14393]
The text was updated successfully, but these errors were encountered: