Push Button Reset in Linux

So everybody is talking about a cool new Windows 8 feature called ‘Push Button Reset’. It will reset settings in Windows 8 to day #1. You can do the same with Linux / Unix, just run the command given below:

Warning: Do not run the following command on prods as upon executing this will halt your system and reset all basic settings.


At boot you need to change the root password, set new network configuration, time config, keyboard config, auth config (like use ldap or pam etc), and services config. Like Windows 8 IE/MSoffice, it will not modify Linux apps settings. Personally, I prefer editing individual files.

This is not a new feature as Windows 8 fan boys are claiming to be and it’s been around for ages. My best guess is that MS-Windows 8 users are going to use this feature frequently :P

Note: I’ve tested sys-unconfig on Solaris and RHEL. I’m not sure about Ubuntu but debconf provides similar features.

How to install LibreOffice (3.4.5 and 3.5.0) on Linux (Fedora, RHEL, CentOS)


LibreOffice, no doubt a great office suite, doesn’t come pre-installed with major Linux distributions so here we are explaining how to install Libreoffice 3.4.5 or 3.5 on Fedora, CentOS and RHEL. Well you have a privilege of installing LibreOffice on Fedora 16 through command line. Following code can do the trick :

yum install libreoffice

Above code will install latest version of Libreoffice. We have more than that in the box, tutorial to install different versions of Libreoffice on Fedora, CentOS and RHEL.

Downloading Packages

Libreoffice 3.4.5 32-bit stable version

wget http://download.documentfoundation.org/libreoffice/stable/3.4.5/rpm/x86/LibO_3.4.5_Linux_x86_install-rpm_en-US.tar.gz

LibreOffice 3.4.5 64-bit stable version

wget http://download.documentfoundation.org/libreoffice/stable/3.4.5/rpm/x86_64/LibO_3.4.5_Linux_x86-64_install-rpm_en-US.tar.gz

LibreOffice 3.5.0 RC3 32-bit stable version

wget http://download.documentfoundation.org/libreoffice/testing/3.5.0-rc3/rpm/x86/LibO_3.5.0rc3_Linux_x86_install-rpm_en-US.tar.gz

LibreOffice 3.5.0 RC3 64-bit stable version

wget http://download.documentfoundation.org/libreoffice/testing/3.5.0-rc3/rpm/x86_64/LibO_3.5.0rc3_Linux_x86-64_install-rpm_en-US.tar.gz

Switch to root

su -


sudo -i

Extract Libreoffice downloaded packages

Libreoffice 3.4.5

tar -xvf LibO_3.4.5_*

Libreoffice 3.5.0

tar -xvf LibO_3.5.0*


LibreOffice 3.4.5

cd LibO_3.4.5*
rpm -Uvh RPMS/*.rpm
rpm -Uvh RPMS/desktop-integration/libreoffice3.4-redhat-menus-3.4*.noarch.rpm

Libreoffice 3.5.0

cd LibO_3.5.0*
rpm -Uvh RPMS/*.rpm
rpm -Uvh RPMS/desktop-integration/libreoffice3.5-freedesktop-menus-3.5*.noarch.rpm

..and you are done!

Backup Ubuntu 11.10 using Deja Dup Backup Tool

Do you want to backup your Ubuntu machine? Well, Ubuntu 11.10 comes with a pre-installed backup software which is Déjà Dup Backup Tool. Today I will show how can you take a backup of your system and restore it using this tool.

Follow the procedure given below:

Click on the power icon and then select system settings.

Ubunt 11.10 power button

On the system settings window click on the backup icon.

Ubuntu System Settings

That bring us to the backup window which has four different areas:

1. Overview – shows us general overview and options as well as the Back Up Now and Restore buttons.

Deja Dup

2. Storage – lets us choose our backup location and folder. I’m going to choose a local folder and for Folder I’m going to choose desktop. So this is where the backup will be saved to.

Deja dup Storage

3. Folders – Here we can choose which folders are backed up. So we’ll be backing up the Home folder in this situation. You can use the plus and minus at the bottom to add and remove folders. On the other side we can add some folders to ignore during backup.

Deja dup Folders

4. Schedule – Here we can choose how often we wanna do a backup and how long do you want to keep the backup that you saved.

Deja dup Schedule

Note: You can turn on automatic backups from the Overview area.

Taking a backup

To start backing up, go to the overview area and click on back up now button.

Back Up Now

Now you need to choose an encryption password for a backup. Just type that in and click on Continue.

Encryption password

And after waiting for a while you can see a message that Backup has been completed and you can also see the backup files on the desktop.

Backup completed notification

Restoring from backup file

To restore your Ubuntu go to the Overview area and click on Restore button, this allows us to restore any backup that we have created. After clicking a Restore window will appear which asks for 2 things, first is the Backup location and the second one is the Folder where the backup file is located.

Deja dup Restore

After selecting the locations click on Forward button, you will find a dialog box which will give you an option of selecting the date (in case you have created more than 1 backup).

Deja dup restore date

Click on the Forward button and you’ll see two options:

1) Restore files to original locations
2) Restore to specific folder

Deja dup restore location

Click Forward and it will ask for the encryption password, this is the password that you’ve set while creating the backup. Enter the password and you have successfully restored our backup.


deja dup restore password

Thanks for reading this quick tutorial on backup Ubuntu using Deja Dup, I would love to see in the comment section down below what everyone else is using for backup and restoration program. Let me know down below, thanks for reading the article, have a great day!

Backup your Linux remotely using rsync command

rsync is a command in Linux which stands for remote sync. It is used for backing up the data. It synchronizes the directories and files from one location to another in a good way. The backup destination could be either on local or on remote server.


  • Speed: rsync replicates all the data from source to destination and then it transfers only the changed blocks/bytes to the destination. This makes the transfer fast.
  • Security: It uses encryption using ssh technique.
  • Bandwidth: It compresses the block at source and then at the receiving end it decompresses the block. It transfers the data block by block using compression and decompression at source and destination side respectively. Hence uses less bandwidth.
  • Privileges: No extra privileges are required to use rsync.


$ rsync options source destination

Case 1: Synchronize two directories in local server

use rsync -zvr command (z to enable compression, v for verbose, r for recursive)

$ rsync -zvr /var/opt/installation/inventory/ /root/temp

The above command does not preserves the timestamp.

Case 2: Preserve timestamps using rsync -a

The -a options preserves symbolic links, permissions, timestamp, owner and group.

$ rsync -azv /var/opt/installation/inventory/ /root/temp/

Case 3: Synchronize only a single file

Specify the file name to the rsync command

$ rsync -v /var/lib/rpm/Pubkeys /root/temp/

Case 4: Synchronize files Local->Remote

$ rsync -avz /root/temp/ [email protected]:/home/chankey/temp/

Case 5: Synchronize files Remote->Local

$ rsync -avz [email protected]:/var/lib/rpm /root/temp

Case 6: Select remote shell

$ rsync -avz -e ssh [email protected]:/var/lib/rpm /root/temp

rsync -e ssh => uses the ssh shell for remote sync

Case 7: Do not overwrite modified file at destination

If the file at the destination is modified and if we don’t want to change it back to the old one again then using rsync -u option.

$ rsync -avzu [email protected]:/var/lib/rpm /root/temp

Case 8: Synchronize only the directory Tree structure (not files)

use rsync -d option for this purpose.

$ rsync -v -d [email protected]:/var/lib/ .

Case 9: Do not create new file at destination, just update existing files

use --existing option

$ rsync -avz --existing [email protected]:/var/lib/rpm/ .

Case 10: Transfer the entire file

use rsync -W option

#  rsync -avzW  [email protected]:/var/lib/rpm/ /root/temp

How to automount partition in Linux: GUI style

Automount partition in linux like never before. Introducing a tool that can automount partition for you as soon as you boot up your linux box.

One of the Linux Guru’s characteristics is to use command line for everything. One can accomplish anything when well versed with command line tips. After booting up a linux box, one needs to manually mount the partitions. Its not a big deal but it gets really annoying when you keep getting error just because you forgot to mount a partition. This hassle can be avoided by making partitions to automount themselves. It can be accomplished by editing few system files but we are not going there. This post is for those ‘lazy’ ones who don’t want to trouble themselves with system files and all, here we are going to automount partition in graphical manner. We have a tool available that can automount partition right after booting.

PySDM: PyGTK Storage Device Manager

PySDM is a Storage Device Manager that is widely used by users to automount partition without touching fstab. Read more about it here.

PySDM for Ubuntu

Download PySDM to automount partition in Ubuntu and other Debian based distros by executing following command.

sudo apt-get install pysdm


PySDM for Fedora

Download PySDM to automount partition in RHEL/CentOS/Fedora by executing following command:

sudo yum install pysdm


PySDM for Arch Linux

Download PySDM to automount partition in Arch linux, link: https://aur.archlinux.org/packages.php?ID=16992

When you are done with downloading, start the tool by shooting following command in terminal as a root:

sudo pysdm

A prompt for password will appear, past that you will see following window with partitions listed on the left:

 automount partition pysdm

Click on Assistant button and following window will appear.

automount partition pysdm

Now you can check and uncheck according to your preferences and you are done, PySDM will now automount partition for you just after booting.

How to view contents of a file in Linux

view file in linux

You can use any of the method given below to view contents of a file in Linux. Let us say the file name is “filename”. Then you can view its content…

1. using cat command

cat filename


cat < filename

2. using head command

head filename

3. using tail command

tail filename

4. using pg command

pg filename

5. using more command

more filename

6. using paste command

paste filename

7. using grep command

grep '.*' filename

8. using cut command

cut -c 1- filename

9. using while loop

while read line
>echo $line
>done < filename

10. using xargs command

xargs -L1 < filename

11. using sed

sed '' filename


sed -n 'p' filename


sed -n '1, $p' filename

12. using awk

awk '1' filename


awk '{print;}' filename


awk '{print $0;}' filename

13. using perl

perl -pne '' filename


perl -ne 'print;' filename


perl -ne 'print $_;' filename

If you know some more ways then share them in comments.

How to install VLC 2.0 on Ubuntu or Linux Mint

VLC 2.0

VLC is an open-source media player whose latest version VLC 2.0 was released some days ago.

VLC 2.0

New features of VLC 2.0

This new version includes multi-threaded decoding for a variety of popular formats. New audio and video filters have been added in this update. Blu-ray support has also been added. MKV demuxer has been improved. Broadcom CrystalHD hardware decoding is now available and some minor changes have been done on the interface.

How to install VLC 2.0 on Ubuntu 12.04

Ubuntu 12.04 users can install VLC 2.0 directly from the Ubuntu Software Center.

How to install VLC 2.0 on Ubuntu 11.10 or Linux Mint 12

Ubuntu 11.10 users will have to use the commands given below to install VLC 2.0

 sudo add-apt-repository ppa:n-muench/vlc
 sudo apt-get update
 sudo apt-get install vlc

How to install VLC 2.0 on Ubuntu 10.10 or Linux Mint 10

 sudo add-apt-repository ppa:lucid-bleed/ppa
 sudo apt-get update
 sudo apt-get install vlc vlc-plugin-pulse mozilla-plugin-vlc

vlc 2.0 linux mint

How to change Ubuntu logo in Enlightenment E17

logo white 128

Enlightenment is a window manager for Linux. It helps you creating beautiful user interfaces with less effort.

In this article we will see how to change Ubuntu logo in E17.

Open any text editor (I prefer gedit), copy paste the code given below and save it as filename logo_ubuntu.edc in the folder Downloads.

collections { 
group { 
name: "e / modules / start / main", 
max: 128 128; 
images { 
image: "logo_white_128.png" COMP; 
image: "logo_black_128.png" COMP; 
parts { 
part { 
name: "base " 
description { 
state: "default" 0.0; 
aspect: 1.0 1.0; 
aspect_preference: BOTH; 
image.normal "logo_white_128.png"; 
description { 
state: "active" 0.0; 
inherit "default" 0.0; 
visible: 0 ; 
color: 255 255 255 0; 
part { 
name: "over"; 
description { 
state: "default" 0.0; 
visible: 0; 
rel1.relative: -0.5 -0.5; 
rel2.relative: 1.5 1.5, 
Color: 255 255 255 0, 
aspect: 1.0 1.0; 
aspect_preference: BOTH; 
image.normal "logo_black_128.png"; 
description { 
state: "active" 0.0; 
inherit "default" 0.0; 
rel1.relative: 0.0 0.0; 
rel2.relative : 1.0 1.0; 
visible: 1, 
color: 255 255 255 255; 
programs { 
program { 
name: "on" 
signal "e, state, Focused" 
source "and" 
action: STATE_SET "active" 0.0, 
transition: LINEAR 0.2, 
target: "base" 
target "over"; 
program { 
name: "off" 
signal "e, state, unfocused" 
source "and" 
action: STATE_SET "default" 0.0, 
transition: LINEAR 0.3, 
target: "base" 
target "over"; 

The code gives following two images.

logo white 128
logo white 128 2

Now open up your terminal and type the commands given below

 cd Downloads
 edje_cc logo_ubuntu.edc
 logo_ubuntu.edj $ mv $ Home / .e / e / themes

Above steps compile the program which we have written and generate a
file which contains the images and moves it to themes folder.

Now go to Menu -> Preferences -> Theme and click ‘Advanced‘ button.

Look for modules/start under Categories. It will open a sub menu, search for logo_ubuntu there. Select it and click on apply.

modules start

You have successfully changed your Ubuntu logo in E17.

ubuntu logo white

ubuntu logo black

How to install Linux Mint’s Cinnamon Desktop on Ubuntu

full cinnamon desktop

full cinnamon desktop

Recently Linux Mint’s developer team released Cinnamon for Linux Mint 13 which is the new desktop environment, it follows the layout of traditional desktops. If you want to try out Cinnamon but you don’t have Linux Mint installed on your system and you are using Ubuntu instead, then you can use the method given below to install it on your Ubuntu machine.

Cinnamon is available in a PPA (personal package archive) for Ubuntu. First of all open the terminal and run the following command:

 sudo add-apt-repository ppa:merlwiz79/cinnamon-ppa


ubuntu terminal

Press Enter when it prompts you. After that update the available packages list by running the command given below:

 sudo apt-get update

Now you can install Cinnamon with this command:

 sudo apt-get install cinnamon cinnamon-session cinnamon-settings

Press Y and Enter when it prompts you.

ubuntu terminal 2

If you are not using Ubuntu then you can go to Cinnamon’s official page to find instructions on how to install cinnamon on your distribution.

Starting Cinnamon

Installing Cinnamon will not replace your default Ubuntu desktop environment. It will just add an option of Cinnamon at your login screen. To enable Cinnamon log out from your current session and from the login screen select Cinnamon and log back in.

starting cinnamon

What you see now is Cinnamon. Start playing with it and check out its features.

set Cinnamon as the default desktop environment

If autologin is enabled in your system then every time the system gets rebooted it will come up with unity by default, then you will have to logout each time you want to switch back to Cinnamon. It will be better to make Cinnamon your default desktop environment, here’s how to do that.

 sudo /usr/lib/lightdm/lightdm-set-defaults -s cinnamon

Removing global menu of Ubuntu

menu bar ubuntu

You will see Ubuntu’s global menu bar is still there (at the top of the screen). If you want to remove it then run the command given below, log out and log back in:

 sudo apt-get remove appmenu-gtk3 appmenu-gtk appmenu-qt

If you want to get it back then use the same command by replacing “remove” with “install”

sudo apt-get install appmenu-gtk3 appmenu-gtk appmenu-qt

How to block a country using iptables?

If you are an admin of a website and you see a lot of bogus traffic coming from some countries which give no profit to you, and you want to block those countries from accessing your website then you can use the bash script given below.

There are two ways to block countries. First is to configure your Apache server and second is to set iptables commands. We will do this using iptables. First of all download the list of IP zone files of the country which you want to block from here.

[Warning]The script will not work if people of that country are using any proxy server or they have spoofed their IP address.[/Warning]

### Block all traffic from AFGHANISTAN (af) and CHINA (CN). Use ISO code ###
ISO="af cn"
### Set PATH ###
### No editing below ###
$IPT -t nat -F
$IPT -t nat -X
$IPT -t mangle -F
$IPT -t mangle -X
# create a dir
[ ! -d $ZONEROOT ] &amp;&amp; /bin/mkdir -p $ZONEROOT
# clean old rules
# create a new iptables list
for c  in $ISO
	# local zone file
	# get fresh zone file
	$WGET -O $tDB $DLROOT/$c.zone
	# country specific log message
	SPAMDROPMSG="$c Country Drop"
	# get
	BADIPS=$(egrep -v "^#|^$" $tDB)
	for ipblock in $BADIPS
	   $IPT -A $SPAMLIST -s $ipblock -j LOG --log-prefix "$SPAMDROPMSG"
	   $IPT -A $SPAMLIST -s $ipblock -j DROP
# Drop everything
# call your other iptable script
# /path/to/other/iptables.sh
exit 0

You must be logged in as a ‘root’ user to run this script. Mention the country names which you want to block in ‘ISO’.

To run the script

# /path/block_country.sh

You can add this script to crontab so that it will run automatically.

@weekly /path/block_country.sh

Below is an another script which does the same work:

wget -c --output-document=iptables-blocklist.txt http://blogama.org/country_query.php?country=$COUNTRIES
if [ -f iptables-blocklist.txt ]; then
  iptables -F
  IPS=$(grep -Ev "^#" $BLOCKDB)
  for i in $IPS
    iptables -A INPUT -s $i -j DROP
    iptables -A OUTPUT -d $i -j DROP
rm $WORKDIR/iptables-blocklist.txt