How to discover what Linux distribution is in use

前端 未结 12 1571
青春惊慌失措
青春惊慌失措 2020-12-02 20:46

Sometimes I need to access some servers running Linux (or maybe another Unix-like SO), but I don\'t know how to verify which distribution is in use on the server (there are

12条回答
  •  难免孤独
    2020-12-02 21:37

    This is, annoyingly, a harder problem than it appears.

    For Linux systems, use lsb_release.

    $ lsb_release --all
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 8.04.1
    Release:        8.04
    Codename:       hardy
    $ lsb_release -i
    Distributor ID: Ubuntu
    

    This has the limitation that lsb_release works only for Linux releases.

    For all Unix systems, you can also parse up uname.

    $ uname -a
    Linux blue-laptop 2.6.24-21-generic #1 SMP Tue Oct 21 23:43:45 UTC 2008 i686 GNU/Linux
    

    You can find some information about the systems and distributions at the uname Wikipedia page.

提交回复
热议问题