Author Archives: Himanshu Arora

About Himanshu Arora

Himanshu Arora is a software programmer, open source enthusiast and Linux researcher. He writes technical articles for various websites and blogs. Some of his articles have been featured on IBM developerworks, ComputerWorld and in Linux Journal. He is the administrator of the blog and also contributes useful posts on the blog. Visit his google+ profile or mail him at himanshuz.chd[at]mylinuxbook[dot]com.

5 Ways To Check If Linux OS is 32 bit or 64 Bit

Sometimes Linux newbies get confused while downloading a software because the download page offers them both 32 bit and 64 bit versions of the same software. It is important to know whether your Linux OS is 32-bit or 64-bit, as this information is required while doing various tasks. In this article, we will discuss five different ways to check if your Linux OS is 32-bit or 64-Bit.

Check If Linux is 32-bit or 64-Bit

Please note that the methods mentioned in this article are tested on Ubuntu 13.10.

1. Execute the ‘uname -a’ command

One of the most common way to check if your Linux OS is 32 bit or 64 Bit is by running the uname command.

For example, on my system, it displayed the following information:

$ uname -a
 Linux ubuntu 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:12:00 UTC 2013 i686 athlon i686 GNU/Linux

The highlighted i686 (or i386 in some cases) signifies that the operating system is 32 bit, but if x86_64 appears, then it means that the OS is 64 bit.

2. Execute the ‘uname -m’ command

A similar but slightly different way is to run the ‘uname -m’ command.

For example, on my system, it displayed the following information:

$ uname -m
 i686

Which means that my Ubuntu Linux is 32-bit. If it would have been 64 bit, the output would have been x86_64.

3. Using the file command

Although it’s a kind of hack, but still it can be used to solve the purpose. In this case, you have run the file command with /sbin/init as an argument.

Here is an example :

$ file /sbin/init
 /sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xc0d86a25a7abb14cad4a65a1f7d03605bcbd41f6, stripped

The highlighted 32-bit signifies a 32-bit OS, and vice-versa.

4. Using the arch command

Another alternative is to use the arch command, which prints the machine hardware name.

Here is an example:

$ arch
 i686

So you can see that the output was i686, which signifies a 32-bit OS. For a 64-bit OS, the output would have been x86_64.

5. Through system settings

If you are using Ubuntu 12.04 or higher, you can easily check your OS architecture by going to All Settings -> Details.

details

So you can see that the OS type (32-bit) is clearly mentioned here.

Do you know other ways to check if Linux OS is 32 bit or 64 Bit? Share your ideas in comments

tailf : Follows The Growth Of A Log File, Better Than ‘tail -f’

Do you use Linux on your laptop? Do you use ‘tail -f’ command frequently? If the answer to both these questions is YES, there is a better solution in form of Linux tailf command. It works same as ‘tail -f’ but is better than it in terms of saving battery life of your laptop. In this article, we will quickly learn some aspects of this command.
Continue reading

MegaCmd – A Command Line Utility To Access Kim Dotcom’s Mega Cloud Storage

For all those Linux command line freaks, who want to access Kim Dotcom’s Megaupload replacement http://mega.co.nz through command line, here is a good news. I recently stumbled upon an open source command line client Megacmd, developed specifically for the same purpose. In this article, I will discuss how to download, install, configure and use this command line client.
Continue reading

dtrx – A Versatile Tool To Easily Extract tar, zip, cpio, rpm, deb, gem, 7z, cab, rar, and InstallShield Archives

If you are an experienced Linux user, you would have definitely dealt with various archive formats. For example, tar, zip, rpm, deb, 7z, and more. Extracting these archives requires either different commands, or different command line arguments in case the command is same. Well, if you always wanted a single command that could extract most of the commonly used archive formats without any complexity, your search ends here. In this article, we will discuss dtrx command, which can extract all the popular archive formats.
Continue reading

lsblk – Command To Display Block Device Information In Linux

Have you ever dealt with block devices in Linux? Well, it is unlikely if you are not a file system pro, but as a system admin you should know some basic commands that can help you debug a file system-related problem in Linux. In this article, we will discuss the lsblk command, which displays block device related information in Linux.

NOTE – To know basics of block devices in Linux, read this tutorial.

lsblk Command in Linux

Here is a snapshot of the description of lsblk command from its man page :

lsblk-main

Testing Environment

  • OS – Ubuntu 13.04
  • Shell – Bash 4.2.45
  • Application – lsblk 2.20.1-5.1ubuntu8

A Brief Tutorial

Lets understand its usage through some practical examples.

1. List block devices

To list block devices using this command, just run it without any option :

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
├─sda1   8:1    0    50G  0 part 
├─sda2   8:2    0    20G  0 part 
├─sda3   8:3    0 132.9G  0 part 
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0   1.3G  0 part [SWAP]
└─sda6   8:6    0  28.7G  0 part /
sr0     11:0    1  1024M  0 rom

So you can see that a lot of information related to block devices is displayed in the output.

If it is required to display information corresponding to all the devices, use the -a option.

Here is an example :

$ lsblk -a
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
├─sda1   8:1    0    50G  0 part 
├─sda2   8:2    0    20G  0 part 
├─sda3   8:3    0 132.9G  0 part 
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0   1.3G  0 part [SWAP]
└─sda6   8:6    0  28.7G  0 part /
sr0     11:0    1  1024M  0 rom  
ram0     1:0    0    64M  0 disk 
ram1     1:1    0    64M  0 disk 
ram2     1:2    0    64M  0 disk 
ram3     1:3    0    64M  0 disk 
ram4     1:4    0    64M  0 disk 
ram5     1:5    0    64M  0 disk 
ram6     1:6    0    64M  0 disk 
ram7     1:7    0    64M  0 disk 
ram8     1:8    0    64M  0 disk 
ram9     1:9    0    64M  0 disk 
loop0    7:0    0         0 loop 
loop1    7:1    0         0 loop 
loop2    7:2    0         0 loop 
loop3    7:3    0         0 loop 
loop4    7:4    0         0 loop 
loop5    7:5    0         0 loop 
loop6    7:6    0         0 loop 
loop7    7:7    0         0 loop 
ram10    1:10   0    64M  0 disk 
ram11    1:11   0    64M  0 disk 
ram12    1:12   0    64M  0 disk 
ram13    1:13   0    64M  0 disk 
ram14    1:14   0    64M  0 disk 
ram15    1:15   0    64M  0 disk

So you can see that the information related to all the block devices is displayed in output.

2. Print the SIZE column in bytes

Use the -b option to achieve this :

$ lsblk -b
NAME   MAJ:MIN RM         SIZE RO TYPE MOUNTPOINT
sda      8:0    0 250059350016  0 disk 
├─sda1   8:1    0  53686370304  0 part 
├─sda2   8:2    0  21476206080  0 part 
├─sda3   8:3    0 142683932160  0 part 
├─sda4   8:4    0         1024  0 part 
├─sda5   8:5    0   1372585984  0 part [SWAP]
└─sda6   8:6    0  30836523008  0 part /
sr0     11:0    1   1073741312  0 rom

So you can see that the SIZE column displays values in bytes.

3. Hide the information related to slaves

In the last example, observe that information related to sda and its slaves was displayed in the output. If you do not want to display slave related information, use the -d option.

$ lsblk -d
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda    8:0    0 232.9G  0 disk 
sr0   11:0    1  1024M  0 rom

So you can see that the information related to slaves is not displayed in the output.

4. Output information about the owner, group and mode

To display information related to the owner, group and mode of the block device, use the -m option.

$ lsblk -m
NAME     SIZE OWNER GROUP MODE
sda    232.9G root  disk  brw-rw----
├─sda1    50G root  disk  brw-rw----
├─sda2    20G root  disk  brw-rw----
├─sda3 132.9G root  disk  brw-rw----
├─sda4     1K root  disk  brw-rw----
├─sda5   1.3G root  disk  brw-rw----
└─sda6  28.7G root  disk  brw-rw----
sr0     1024M root  cdrom brw-rw----

5. Use key=value output format

This can be achieved by using -P options.

Here is an example :

$ lsblk -P
NAME="sda" MAJ:MIN="8:0" RM="0" SIZE="232.9G" RO="0" TYPE="disk" MOUNTPOINT=""
NAME="sda1" MAJ:MIN="8:1" RM="0" SIZE="50G" RO="0" TYPE="part" MOUNTPOINT=""
NAME="sda2" MAJ:MIN="8:2" RM="0" SIZE="20G" RO="0" TYPE="part" MOUNTPOINT=""
NAME="sda3" MAJ:MIN="8:3" RM="0" SIZE="132.9G" RO="0" TYPE="part" MOUNTPOINT=""
NAME="sda4" MAJ:MIN="8:4" RM="0" SIZE="1K" RO="0" TYPE="part" MOUNTPOINT=""
NAME="sda5" MAJ:MIN="8:5" RM="0" SIZE="1.3G" RO="0" TYPE="part" MOUNTPOINT="[SWAP]"
NAME="sda6" MAJ:MIN="8:6" RM="0" SIZE="28.7G" RO="0" TYPE="part" MOUNTPOINT="/"
NAME="sr0" MAJ:MIN="11:0" RM="1" SIZE="1024M" RO="0" TYPE="rom" MOUNTPOINT=""

So you can see that the output is displayed in a key=value format.

This command provides a lot of other options, read this man page for more options.

Download/Install/Configure

Here are some of the important links related to the lsblk command :

  • Home Page [Let me know if you find home page of this utility]
  • Download Link

The lsblk command comes as a part of util-linux package which is pre-installed in most of the Linux distributions.

Pros

  • Pre-installed in most Linux distributions
  • Provides lots of options

Cons

  • Some options require good knowledge of block devices in Linux

Conclusion

lsblk is a good utility for fetching information related to block devices. Though it is not for normal users but a handy tool for system administrators and Linux pros. Keep it in your tool set, it’ll definitely help you some day.

Have you ever used lsblk command or any other similar command line utility? Share your experience with us.

look : Linux Command To Verify Spellings And Display Lines Beginning With A String

Have you ever felt the need of a command line utility in Linux through which you can verify spellings? A utility that can display lines in file which contain a particular string as a prefix? Well, in this article we will discuss the look command in Linux that is capable of doing both these tasks.

Continue reading

Quick Open : A Gedit Plugin That Lets You Quickly Open Files

Gedit is one of my favourite GUI-based text editor in Linux, I really like its simple UI. But, I always felt the need of a better alternative or rather quicker alternative to open files especially when it is required to be done frequently. This was the situation until I stumbled upon Quick Open, a gedit plugin that lets you quickly open files. In this article, we will understand the way it works.
Continue reading

Plank : A Simple And Lightweight Dock For Lean Desktops

In one of our earlier article, we covered Cairo-Dock — a MAC OS X style desktop interface that provides a graphic rich dock for launching applications. But, the fact is that not everybody wants animation-rick dock, especially if you are working on lean desktops like XFCE. In this article, we will discuss Plank — a simple dock with minimalistic look and feel.
Continue reading

Reditr : An Unofficial Desktop Application For Reddit

Reddit is a popular social news website where users submit interesting content in form of text or links and fellow users up-vote or down-vote the submissions according to their liking. The website has one of the largest following on internet and is also known as the ‘Front Page of Internet’. In this article, we will discuss a desktop application Reditr that lets users easily access reddit on Linux systems.

Continue reading