Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I know there is, for example, hostnamectl command on linux and system_profiler SPSoftwareDataType command on macOS to know the operating system version, but I'm looking for a command that works for both operating systems. Does it exist?
hostnamectl
system_profiler SPSoftwareDataType
uname -v
I use uname -s with tr inside Makefile to determine the system and decide whether to use .so od .dylib.
uname -s
tr
Makefile
.so
.dylib
On macOS
> uname -s | tr '[:upper:]' '[:lower:]' darwin
On Linux
> uname -s | tr '[:upper:]' '[:lower:]' linux
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
uname -vis probably the closest you can get. Its output, though, isn't particularly standardized.