Custom Search

How to check Ubuntu server Linux version

If you are a Windows user before, there is no ver command in Linux that can be used to check the version of Ubuntu server.  In  Linux  or  Ubuntu  server specifically, there are many commands that can be used to check operating system version.

The first command that can be used to check Ubuntu server version is, as Ubuntu suggest, the lsb_release -a command. Here is the example:

luzar@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 8.10
Release:        8.10
Codename:       intrepid
luzar@ubuntu:~$

Second command that we can use to check Linux version is cat /proc/version. See example below:

luzar@ubuntu:~$ cat /proc/version
Linux version 2.6.27-14-server (buildd@palmer) (gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12) ) #1 SMP Wed Apr 15 19:44:38 UTC 2009
luzar@ubuntu:~$
 
We can also view all information about Ubuntu server using uname -a option:

luzar@ubuntu:~$ uname -a
Linux ubuntu 2.6.27-14-server #1 SMP Wed Apr 15 19:44:38 UTC 2009 i686 GNU/Linux

There you go. We've got more information than what we ask for. Well, that's good, isn't it?

How to add user to a group in Linux operating system

We can assign user to a group during adding a new user account. But how do we add existing user to a group? This tutorial is a guide on how to add user to a new group. The right Linux command for the job is the usermod command.

This is some information about Linux usermod command from manual page:

NAME
usermod - modify a user account

SYNOPSIS
usermod [options] LOGIN

DESCRIPTION
The usermod command modifies the system account files to reflect the
changes that are specified on the command line.


As you can see, the Linux usermod command can be used to modify a user account. However in this tutorial, we'll only use usermod command to add user to a new group. For this example, we'll create a new group to practice. Use the groupadd command to create a new group:

luzar@ubuntu:~$ groupadd programmer
groupadd: unable to lock group file
luzar@ubuntu:~$ sudo groupadd programmer
[sudo] password for luzar:
luzar@ubuntu:~$

Don't forget to use sudo command in Ubuntu, else you'll get the groupadd: unable to lock group file error as in the example above. Check whether the programmer group has been created in /etc/group file:

luzar@ubuntu:~$ less /etc/group | grep programmer
programmer:x:1001:
luzar@ubuntu:~$

Next, we are going to add user to a new group. For this example, we are going to add a user called luzar to the programmer group. Below are step by step instructions.

Use usermod -G option to add user to a new group:

luzar@ubuntu:~# sudo usermod -G programmer luzar

Use Linux groups command to check whether the programmer group has been added to luzar's group:

luzar@ubuntu:~# groups luzar
luzar : users programmer
luzar@ubuntu:~#

As you can see, the user luzar now has programmer as a second group. We can also check /etc/group to verify user currently in the programmer group:

luzar@ubuntu:~$ less /etc/group | grep programmer
programmer:x:1001:luzar
luzar@ubuntu:~$

That's all.