Results 1 to 5 of 5

Thread: Bash command to determine Ubuntu version number

  1. #1
    Join Date
    Apr 2008
    Beans
    24

    Bash command to determine Ubuntu version number

    Hi,

    Anyone know the bash command that would allow you to determine what version of Ubuntu (7.04, 7.10, 8.04) you are using.

    I want a script to:

    check version number and

    if ubuntu 7.04

    then

    elsif ubuntu 7.10

    then

    elsif ubuntu 8.04

    then

    elsif none of the above

    then exit

    thank you very much in advance...
    Last edited by t-molli; January 9th, 2011 at 01:02 AM.

  2. #2
    Join Date
    May 2005
    Location
    Lecce, Italy
    Beans
    6,168
    Distro
    Ubuntu

    Re: Bash command to determine Ubuntu version number

    Type this command:
    Code:
    lsb_release -r
    and you will get something like this:
    Code:
    Release:	8.04

  3. #3
    Join Date
    Apr 2007
    Beans
    14,781

    Re: Bash command to determine Ubuntu version number

    Code:
    cat /etc/issue
    (also)

  4. #4
    Join Date
    Feb 2011
    Beans
    7

    Re: Bash command to determine Ubuntu version number

    You can also run this command:

    Code:
    . /etc/lsb-release
    ...and the following variables would be opened up in your script:

    Code:
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=12.04
    DISTRIB_CODENAME=precise
    DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"

  5. #5
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Bash command to determine Ubuntu version number

    Good command, but this thread is from 2008 and is going back to sleep.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •