Linux shell

Linux distribution info & kernel info

Do you have multiple vms and real machines you use for random testing, and small tasks? need to know what machine you are on? what kernel you are using? what the current Linux distribution info is? what OS version did you last install on here? and more such questions? well! we have some of the answers for you. well maybe not answers, but more like small tools so you can get the answers!

Distribution info

lsb_release -a
on my ubuntu system it gives the following result :

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Xenial Xerus (development branch)
Release: 16.04
Codename: xenial

On a debian system it gives the following result :

# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.4 (jessie)
Release: 8.4
Codename: jessie

If lsb_release -a doesn’t cut it for you then you can try
cat /etc/issue

as a result we see the following examples :

# cat /etc/issue
Debian GNU/Linux 8 \n \l

$ cat /etc/issue
Ubuntu Xenial Xerus (development branch) \n \l

In some cases where you suspect you are on centos or redhat, maybe because you noticed the package versions are old enough to be used by columbus while sailing the open seas, then you can use either

cat /etc/centos-release


cat /etc/redhat-release

which will give you result such as :

CentOS release 6.2 (Final)

Kernel Info

now as far as finding the kernel info goes you can get all the info you need via uname.

$ uname -a
Linux testhost 4.4.0-9-generic #24-Ubuntu SMP Mon Feb 29 19:33:19 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ uname -r

as you can see uname -r gives you just the kernel version and uname -a gives you multiple pieces of info, like date the kernel was compiled, the arch (i.e. x86_64).

Linux shell

Start Xvfb on boot on Centos Linux


Xvfb or X virtual framebuffer

X virtual framebuffer is a display server using the X11 protocol. In contrast to other display servers, it performs all graphical operations in memory without showing any screen output. which makes it ideal for some surprising uses. e.g.

Xvfb :1 &
xv -display :1 &
import -display :1 -window root image.png

(above snippet via Wikipedia)

I had to run xvfb automatically on boot on a centos system, here’s the init script I used to carry out the task. add the following as a script to /etc/init.d , chmod +x the script then chkconfig xvfb on

* Note: see the :11 in the middle of the script? change that to another number to change the display port.

   # chkconfig: 345 95 50
   # description: Starts xvfb on display 11
   # why 11? dunno I just work here. :( -FB
   # 9/30/13 r1 - initial addition -FB

   if [ -z "$1" ]; then
   echo "`basename $0` {start|stop}"

   case "$1" in
       /usr/bin/Xvfb :11 &

       killall Xvfb

[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”bottom above footer” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

[/et_pb_text][et_pb_divider admin_label=”Divider” color=”#ffffff” show_divider=”off” divider_style=”solid” divider_position=”top” hide_on_mobile=”on”] [/et_pb_divider][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]



Linux shell

Yum install dependencies for a local RPM

Got an RPM laying about you need to install but it has a bunch of dependencies? well let yum do the heavy lifting.

yum --nogpgcheck localinstall SomeApp.noarch.rpm