Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have always found it difficult to find information about the system itself in Unix, whether it be

  • Which OS I am using (version number and all, to compare it with the latest available builds)?

  • Which Desktop Environment am I using? If I am using KDE, most of the programs begin with a K and I can say I am using KDE, but there should be some way to query this, say from a script.

  • Which kernel version am I using? (For example, I am using Fedora, and I want to know what Linux kernel version I am using)

Basically, what I miss is a single point/utility that can get all this information for me. Most of the times the solutions to the above would themselves be OS specific. Then, you are stuck.

share|improve this question
    
hehe just asked a similar question, I'm struggling to understand all the desktop/desktop environment/ window managers/etc unix.stackexchange.com/questions/1151/… –  BlackTigerX Aug 24 '10 at 2:50
add comment

6 Answers 6

up vote 11 down vote accepted

In addition to uname -a, which gives you the kernel version, you can try:

lsb_release -idrc  # distro, version, codename, long release name

Most Desktop Environments like GNOME or KDE have an "about" or "info" menu option that will tell you what you use currently, so no commandline needed there really.

share|improve this answer
    
laeys why not lsb_release -a? –  lesmana Aug 24 '10 at 16:49
    
Because it also lists which LSB-modules are (supposed to be) supported on the machine, and most people don't really care about that. But of course it works too... –  JanC Aug 25 '10 at 0:43
1  
LSB is Linux only afaik, so this would only work for Linux and not BSD, Solaris, or any other Unix system. –  jonescb Jan 18 '11 at 18:00
add comment

As @milk pointed out, you can use uname -a and that will tell you information on all the UNIXes I have access to. For example, on Linux:

Linux localhost 2.6.33.6-147.2.4.fc13.x86_64 #1 SMP Fri Jul 23 17:14:44 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

On FreeBSD:

FreeBSD localhost 6.3-RELEASE-p3-jc1 FreeBSD 6.3-RELEASE-p3-jc1 #2: Thu Aug  7 14:36:29 PDT 2008 user@jail7.johncompanies.com:/usr/obj/usr/src/sys/jail7  i386

On OpenSolaris:

SunOS localhost 5.11 snv_134 i86pc i386 i86pc

As far as the desktop environment question goes, you should be able to echo $DESKTOP_SESSION in KDE or GNOME and get back the right answer.

If you want to find out what distro you're running, a cheater's shortcut is to cat /etc/*-version /etc/*-release.

share|improve this answer
    
echo $DESKTOP_SESSION default I guess this returns whatever gdm/kdm/etc had put into it? which might be useful... also uname -a is ok... but take my arch string Linux slave-iv 2.6.35-ARCH #1 SMP PREEMPT Fri Aug 20 22:49:24 CEST 2010 x86_64 Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz GenuineIntel GNU/Linux you'll note the minor kernel version is not present due to the way it was compiled –  xenoterracide Aug 24 '10 at 5:52
add comment

Maybe you can use

uname -a

to get information about the kernel version and which OS you are using.

share|improve this answer
add comment

Run gnome-system-monitor (package is the same name in Debian, Ubuntu, and Fedora), and click on the System tab:

alt text

The desktop thing is a little hard because you can have multiple ones installed, and can run one package belonging to one desktop on a different desktop. Also, running printenv DESKTOP_SESSION on my Debian system just outputs default (but it works well on Ubuntu and Fedora).

share|improve this answer
add comment

Not totally foolproof, but halfway there:

xwininfo -root -children|grep kwin
xwininfo -root -children|grep gnome-panel

(I can't help it if you feel like using gnome-panel under kwin, though ;-) Also, I find this very useful under Linux:

cat /etc/issue
share|improve this answer
add comment

Building on everyones post above, maybe run a simple script

#!/bin/bash
lsb_release -idrc ; printenv DESKTOP_SESSION ; uname -a 

running that gives me

Distributor ID: LinuxMint
Description:    Linux Mint 9 Isadora 
Release:    9 Codename: isadora 
gnome 
Linux judas327 2.6.32-24-generic-pae #39-Ubuntu SMP Wed Jul 28 07:39:26 UTC 2010 i686 GNU/Linux
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.