View Your Linux Distro Version From The Command Line

Many different Linux distributions will display their version information in one place or another in the GUI. If you need to pull this information quickly, it may just be easier to open a terminal window and find it from the command line.

You can view your distro’s version information with the lsb_release command. To view all of the information available, use the -a switch.

[term]lsb_release -a[/term]

This yields the following information when run on my netbook:

[term]

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 10.10
Release:	10.10
Codename:	maverick

[/term]

You can eliminate the field names by adding the -s switch for short output.

[term]lsb_release -as[/term]

Which gives this as output:

[term]

No LSB modules are available.
Ubuntu
Ubuntu 10.10
10.10
maverick

[/term]

Each field can also be extracted with its own switch as well;

  • -i for Distributor’s ID
  • -d for Description
  • -r for Release
  • -c for Codename

For more information, check out the manual page for lsb_release.

[term]man lsb_release[/term]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.