Reputation: 2612
I want to know, how can we check in the bashrc file, what operating system is it?
Upvotes: 13
Views: 37583
Reputation: 30833
There is no portable way to know what Operating System is running.
Depending on the OS, uname -s
will tell you what kernel you are running but not necessarily what OS.
Moreover, it cannot be SunOS or Unix or Solaris. Solaris is all of them: both a Unix compliant OS and an OS based on the SunOS kernel.
One of these might give you a precise answer depending on the Unix or Linux implementation:
cat /etc/release # SVR4, Solaris
cat /etc/redhat-release
cat /etc/*elease
cat /etc/lsb-release
oslevel -r # AIX
system_profiler -detailLevel -2 # Mac OS/X
Upvotes: 6
Reputation:
Try this:
$cat /etc/os-release
NAME="Ubuntu"
VERSION="12.04.4 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.4 LTS)"
VERSION_ID="12.04"
Upvotes: 4