Tag Archive: Ubuntu



Sometimes we want out Linux box to speak to/for us.This ability is very useful to make announcements and alerts in case of many critical events in our machines or can be used just for sheer fun. There exists a command line synthesized known as espeak that comes pre installed in Ubuntu. You can also install it on debian systems by typing the command sudo apt-get install espeak  in a command console .For all other operating systems you can install it from source available at http://espeak.sourceforge.net/download.html The usage of espeak is pretty straight forward, just  type  espeak   “text to announce”  in a text console and listen your computer speaking the text.Some basic options to control espeak  are :

a <integer>     sets the amplitude/loudness of the speech
f <filename>  speaks the content of the given file
p <integer>     sets the pitch/frequency of the speech

s <integer>     sets the speed of the speech in words/minute 

Espeak is a cross platform utility that runs on more than half a dozen of OS platforms. So go through its man page by typing man espeak in a text console , explore it more and make your machine speak.

Pages : Follow ankurtwi on Twitter      


Command line terminals are an indispensable part of *IXs. We all need those sooner or later. Usually we want to open many terminals at a time to do various things in those but placing them in the same screen is bit chaotic. We have an utility on GNOME  desktop environment  known  as terminator that is able to create multiple terminals in same window. These  multiple terminals could be created by horizontally, verticallly or tab dividing the window. Screenshot of the same is shown below :

Multiple Terminals

To install it on Ubuntu, issue command  sudo apt­-get install terminator. To launch it  on ubuntu go to Applications -> Accessories -> Terminator . You can also type terminator in cli shell to launch it. If you want to install it manually then you can download it from their official page .

The basic key combinations are:

Ctrl+Shift+O for   the  horizontal division
Ctrl+Shift+E for the vertical division,
Ctrl+Shift+T for the  tab  division
Ctrl+Tab  to switch between the created terminals
Ctrl+Shift+q to quit terminator.

The terminator supports a hell lot of functionalities like grouping ,automatic logging,multiple searching etc. For more info about the terminator, access its man page through man terminator command.

Pages : Follow ankurtwi on Twitter      


This trick (by Sumit Rai) was published in Linux For You (LFY) under the Tips And Tricks Section. Sharing it with all the Linux Geeks out there :)

When you format a partition in Linux , 5% of the total space gets reserved for privileged  processes, by default. This is done so that system processes continue to function correctly ,if the filesystem gets full. This is useful for your ‘root’ partition.However if you have let us say 50GB separate home partition, you may want to make use of few additional GBs by reducing the percentage of the reserved space. You can use tune2fs command to change  the default allocation of space  reserved for privileged  processes. Command for the same is :
#tune2fs -m 1  /dev/sda6
Here  we have changed space reserved for privileged  processes on /dev/sda6 to 1 percent. You can use your device file according to the target partition instead of  ‘/dev/sda6′ . You can see the effected change by mounting the filesytem and checking available space using df command before and after you execute the above command. This command is quite useful in so called ‘Emergency’, so do remember it :)

Pages : Follow ankurtwi on Twitter      


I started writing for Linux For You Magazine in August 2010. Since Then I have written over 10 articles for this International Magazine. Today I am providing the readers with all the links to my articles. All the work done is under Creative Common License as described in the sidebar widget also.

1. Let’s Play With Emacs CLI : This teaches you the basics of the ‘Emacs’ Text Editor. This articles was published in the Aug 2010. I published it in two parts on my blog. Click on respective part numbers to read  : Part 1  Part 2  .

2.  Cut and Play With Pitivi Video Editor : A tutorial on how to use Pitivi video editor to play with videos in an experimental way. It was published in the Nov 2010 Edition.  Click to Read

3.  Let’s Play With Gnu Screen :  Tutorial about one of the greatest utility provided by GNU also know as ‘virtual terminal manager’ . It was published in Feb 2011 Edition . Click To Read

4. Get Started With Pygame Part 1 : One of my favorite series :) It teaches you the basics about the pygame API of the python module. Pygame is the python extension of the SDL with some additional benifits. This article was published in May 2011. Click To Read

5. Get Started With Pygame Part 2 : Advance knowledge about the pygame API. Includes the color play and sprites usage tutorial . It was published in July 2011. Click To Read

6. Connection To Mysql With Python  and Php : Simple tutorial on how you can successfully connect mysql to your program of python or php. It was published in Aug 2011 . Click To Read

7. Recovered Deleted Files In Linux :  Different ways of recovering your deleted files using utilities like scalpel , foremost etc. It got published in Sep 2011 . Click To Read

8. Let’s Play With CodeIgniter Part 1 : Teaches you the basics of the PHP based framework ‘CodeIgniter’ . This frameworks is really useful and changes the way I used to code in PHP. It follows the MVC approach. It was published in the Oct Edition. Click To Read

There are certain articles like ‘Let’s Play With VirtualBox’,’Using Nessus and Metasploit’,’Play With GUI’s In Python’ that hasn’t been published  online yet . I will publish them in future on this blog and will provide you the links. So click on the links and explore the stuff :)

Pages : Follow ankurtwi on Twitter      


We all know that file stores our information in many types of formats. But do you know that  we can use it as a storage device too. Surprised???? Let’s go through the crazy process :D

We are going to create a empty file in Linux, format it and then mount it as if we are mounting a partition.  This process is long , So to understand it easily I am dividing it into 4 steps.

Step 1 : Create an empty file of desired size (200MB in this case) using the command

dd if=/dev/zero of=/filename bs=1M count=200

Explanation : dd command allows us to copy a file with specified number of bytes. Here if means input file, of means output file, bs is block size in bytes. You can use suffixes like K (for Kilobytes), M (for Megabytes), and G (for Gigabytes) . Note: If you are using Mac OS, use K, M, G in lower case. Here, I have used bs to be equal to 1MB. Count parameter controls how many number of blocks are copy, So 200 value is used  to create a 200 MB file. Now you might be wondering what is /dev/zero ?? /dev/zero is a special device file that writes zeros. So, our newly created file contains nothing but zeros. You can view, the created file using hexdump command.

"hexdump" Command

Here starting address is 0000000 and each line contains 16 bytes, * in the second line means file only contains zeros from starting address to the end of file (c800190 in hex). This file isn’t of much use to us , So in next step we will create a filesystem so that we can use this file for storage purpose.

Step 2 : Create a filesystem on the file using mfks utility. Type  mkfs -t file_sytem_type /filename. Example: mkfs -t ext2 /filename. As in the image below also , you will get a warning press y and hit enter.

mkfs Command Output

You can also format the file as swap space using mkswap /filename .

Step 3 : Mount the filesystem on the file or enable it as swap space in case you formatted the file as swap.  You can see the images below for better understanding .

Mounting A File

In case of swap :

Mounting A Swapfile

Step 4 : Mount the filesystems at boot time by adding entries. If you want  your filesystem  to get automatically mounted at boot time, add the following entries in /etc/fstab

/filename /mount_point filesystem_type loop,defaults 0 0 

Where filename is the name of the file created, mount_point is the directory where you would like to use the filesystem, file system type means type of formatted filesystem.For Example : /filename /media/extra ext2 loop,defaults 0 0 

After, modifying /etc/fstab, you don’t have to reboot to test changes, you can type mount -a to test the changes, it will give you the details of errors if any during when OS tries to mount the filesystem. For swap space use the following.

/filename none swap defaults 0 0

Note:- While I was testing this on CentOS, mount -a didn’t work for swap, even though I could see adding 204792k swap on /filename. Priority:-1 extents:63 across:478252k in the output of  dmesg | tail, still no swap space was shown by free or swapon -s commands. But, after reboot swap got activated properly.

In answer to adrian comment :

How to extend size of the file:-

Lets say you create a file name /newfile of size 200MB and format it, after a while you want to extend the file size. To do that do the following

Step 1. Lets say you want to increase the file size by 100MB

dd   oflag=append  conv=notrunc  if=/dev/zero  of=/newfile   bs=1MB count=100

Now, the file is 100MB larger.

Step 2. Run file system check on the file

fsck -f /newfile

Step 3. Now if you formatted the file system in ext2,3 or 4, you can resize it by using

resize2fs  /newfile.

Thanks to geoff, Jean Beliveau for the feedback.

Pages : Follow ankurtwi on Twitter      


According to Ubuntu developers, the Ubuntu 12.04 (Long Term Support) has a new release schedule. There will be two Alpha versions, two Beta versions, then there will be a release of the Release Candidate version and finally the complete version will be released. It’s code name is “Precise Pangolin”. The schedule of the release of Ubuntu 12.04 with exact date is as follows.

Alpha 1 release date: December 1st 2011
Alpha 2 release date: February 2nd 2012
Beta 1 release date: March 1st 2012
Beta 2 release date: March 22nd 2012
Release Candidate release date: April 19th 2012
Ubuntu 12.04 Final release date: April 26th 2012

The Ubuntu 12.04 being a LTS release will be expected by many to be a strong OS with remarkable performance and support for features.

Pages : Follow ankurtwi on Twitter      


Ubuntu 10.04 was released last year but it’s still popular among most of the Linux users because of its eye catchy look. Moreover its a LTS release. First thing I noticed when I installed the distro was the missing network applet (bug) . Because of that I was unable to connect to the wireless network. I posted the same in the ubuntu forums community and figured a way out. I posted the solution over there  and it got great response in return too. It got 25,000+ views over there in the forums. Link for the same is http://ubuntuforums.org/showthread.php?t=1469625 . So I thought of sharing it over my blog too . Just follow the steps below and missing network applet will appear on your screen after reboot :

1. In the terminal type  “sudo gedit /etc/NetworkManager/nm-system-settings.conf” (without quotes)
2.Change the “managed=false” to “managed=true” and then save it.
3. Then in the terminal type “sudo killall nm-system-settings”
4. Reboot your system
This solution worked for me :)

Pages : Follow ankurtwi on Twitter      


Linux is generally considered as a geek’s operating system and I am completely agree with it. Linux is not only limited to work only. You can also enjoy a lot while working on it. There are many crazy commands which will bring a big smile on your face. Below we are going to discuss few out of them.

1. Oneko : This utility remembers me of the cat mouse game. Cat chases the mouse pointer regardless of its position. You have to download it from the repository by typing “sudo apt-get install oneko” (without quotes)  in ubuntu .Then just launch it by typing oneko . You will see a cat following your mouse pointer. You can terminate this command by using the famous Ctrl-c.

2. Xpenguins:  We all know about the  relationship  of the Linux with the penguin “Tux”.  By using this utility you will see penguins dancing around your desktop. This command is partially GUI based but can be invoked using the CLI. You can install it by using “sudo apt-get install xpenguins” and can invoke it simply typing xpenguins on your terminal. To terminate follow the same Ctrl-c rule.

3.  Fortune :  You can generate famous quotes using this. It uses the random function during the generation. You can find it in the “fortune-mod” package.  For the installation of the package you need to type “sudo apt-get install fortune-mod” . Launch it by typing  fortune . You can add it  in your bashrc file so that everytime you log in you see a message .

4. Cowsay and Xcowsay : Want to say something to anyone using a cow as a medium?? If yes this utility fits the best. CLI version is cowsay and GUI version is xcowsay . You can find them in the cowsay and xcowsay package respectively. To invoke follow the syntax : cowsay text (CLI) and xcowsay text(GUI) . Example – Let’s say “hello” through the cow.

cowsay hello

xcowsay hello

5. sl (oops ls) : As we all know that the “ls” utility (used for listing of files) is used at a very high rate in  Linux. But sometimes due to high speed typing we typed it “sl” and “ls”. If you had “sl” utility installed you will see a train engine passing by in your command line warning you that you have misspelled the ls. Install sl by using “sudo apt-get install sl”  and invoke it using sl.

There are lots of others crazy commands too. Google them and have fun!!!

Pages : Follow ankurtwi on Twitter      


Have you accidentally deleted an important file because you are in a habit of using “Shift+Del” rather than delete only?? Well don’t panic. There is a utility named as “scalpel”  which helps you in recovering the so called “permanent deleted” files. Actually when you delete a file permanently (Accidentally or By Intention) , It doesn’t get removed from your hard disk. It get stored in certain blocks of the storage device and they continue to exist in the blocks unless you overwrite them with another files. This article will talk about utilities that will help you in the file recovery. It is always recommended that you shouldn’t recover a file from the device when it is mounted. You should always do the recovery process with the Live CD followed by the file searching in the device like in my case device is /dev/sda1 . If you are unable to understand the upper condition, just forget about it. I am not going to bore you with the theory part anymore. Let’s take a look at the utility.  

Scalpel is a file system independent recovery tool. It ‘s basically available for the Linux and Mac OS but you can also run it on windows by compiling it using the mingw. Latest version of scalpel is 2.0 . You can install it in Ubuntu by typing sudo apt-get install scalpel. After installing it you need to do some text editing. Scalpel utility has its configuration file in the /etc directory with full path as /etc/scalpel/scalpel.conf . When viewed (using gedit/nano/cat) you will notice that everything is a comment out there. Uncomment the file format which you want to recover. For example in my case I want to recover the .zip file so I will uncomment the .zip file section in the scalpel.conf file just like below.

scalpel.config


After that go to the terminal and follow the syntax :
sudo scalpel <device name/Directory name/file name> -o <ouput directory>

Output directory is the directory where you want to restore your deleted files. It should be empty before running the command, otherwise you will get an error. You can also input the deleted filename directly by using -i option.You can see the screenshot of my device search below .

Processing

Although utilities are there to recover your file but I would recommend you guys to put a habit of delete only not of “Shift+Del” because prevention is always better than cure :D 

Pages : Follow ankurtwi on Twitter      


LAMP server is the backbone of the Web today and Linux too. Users using Linux get  confused sometimes while setting up the LAMP server . I was going through the articles and found this great and very useful article on “Step up Step Installation of LAMP in Ubuntu 11.04“.
Ubuntu LAMP servers install the following versions-
Ubuntu 11.04 (Natty)
Apache 2.2.17
Mysql 5.1.54
PHP 5.3.5
Read the Full Article At http://www.ubuntugeek.com/step-by-step-ubuntu-11-04-natty-lamp-server-setup.html

 

Pages : Follow ankurtwi on Twitter      

Follow

Get every new post delivered to your Inbox.

Join 70 other followers

%d bloggers like this: