Category Archives: Linux

Debian Squeeze FTW

Recently my laptop battery was being drained too fast in Windows 7. I looked into this and it seemed windows was very efficient with its power management but the problem was my installation was too bloated with additional software and background services that it was eating up too much processor time.

So i decided to install a clean dual boot os which would hopefully have a minimal footprint and not eat up all my battery. And since most of the software i use can also be used in Linux in one way or the other i decided to give it a try.

First i tried Ubuntu 11.04. using its windows installer. This causes it to be installed like a software into windows and dual booting is setup where all the Linux files are stored in a virtual hard disk in one of the windows partitions. This works quite well but the only problem i found is i really did not like the new unity interface. But the good part was everything works out of the box. And i did get stuck once and had to reboot, i think it was compiz but not sure.

Next i installed Open SUSE 11.4. Cause i read on that its the best distro for laptops. The problem here was i really hate the rpm package management system. And was hoping this OS would be worth the trouble. But after trying to install a few software  here and there. It felt awkward not having the power of Debian package management. And somehow I managed to break my GUI after trying to install ATI Driver. So was left with a shell prompt in the end. It was fixable but i decided to go for the fail-safe distribution.

Finally installed Debian 6 (Squeeze), everything worked out of the box. I actually use Debian 5 (Lenny) on my VPS web host server as its knows for its exceptional stability, but haven’t recently tried it on a laptop. I had to do a bit of additional installes before it looked as fancy as Ubuntu. ATI Driver install went smoothly as well. Now with multiple work spaces and compiz expo its so easy working on multiple tasks at once. Almost a 200-300% increase in multitasking management.

So my conclusion is for day to day use Linux is actually easier to use than Windows if you have it setup right. Some distros like Ubuntu are already configured for this. If your new to Linux then Ubuntu is a great start. But for me i think i will stick with Debian because it comes with a more clean install than Ubuntu and it does not have the annoying Unity.

GNU Tar | The Basics Part 1 – Making an archive

GNU tar creates and manipulates archives which are actually collections of many other files; the program provides users with an organized and systematic method for controlling a large amount of data. The name “tar” originally came from the phrase “Tape ARchive”, but archives need not (and these days, typically do not) reside on tapes.

tar command like all unix utilities has a short and long form for parameters..

I will be writing several posts on this to display simplified tar operations the first one will deal with creating new archives.

Below are the most commonly used tar operations and their parameter names

Create a new tar archive.

List the contents of an archive.

Extract the contents of an archive.

Also some common parameters are…

Name of the file

Verbose output.

This post will cover the creat syntax in a simplified by detailed form.

So on to creating tar archives…

Simple Creation

long form

$ tar –create –file=<filename> <file(s)/directory(s) to add>

example : tar –create –file=foobar.tar foo.bar1 foo.bar2 foo.bar3

short form

$ tar -cf <filename> <file(s)/directory(s) to add>

example : tar -cf foobar.tar foo.bar1 foo.bar2 foo.bar3

With verbose output

long form

$ tar –create –verbose –file=<filename> <file(s)/directory(s) to add>

example: tar –create –verbose –file=foobar.tar foo.bar1 foo.bar2 foo.bar3

short form

$ tar -cvf <filename> <file(s)/directory(s) to add>

example: tar -cvf foobar.tar foo.bar1 foo.bar2 foo.bar3

With verbose and gzip compression (fast compression) output

long form

$ tar –create –verbose –gzip –file=<filename> <file(s)/directory(s) to add>

example: tar –create –verbose –gzip –file=foobar.tar.gz foo.bar1 foo.bar2 foo.bar3

short form

$ tar -cvzf <filename> <file(s)/directory(s) to add>

example: tar -cvzf foobar.tar.gz foo.bar1 foo.bar2 foo.bar3

With verbose and bzip2 compression (high compression) output

long form

$ tar –create –verbose –bzip2 –file=<filename> <file(s)/directory(s) to add>

example: tar –create –verbose –bzip2 –file=foobar.tar.bz2 foo.bar1 foo.bar2 foo.bar3

short form

$ tar -cvjf <filename> <file(s)/directory(s) to add>

example: tar -cvjf foobar.tar.bz2 foo.bar1 foo.bar2 foo.bar3

How to cheat 'Argument list too long' error while using wildcards

The problem is that the linux terminal shell has a limit to the length of the command line arguments.

And this can vary from kernel to kernel basis, depends on the kernel configuration during kernel compilation.

So most of the time this will not be an issue but if your trying to manipulate multiple files in Linux console using the ‘*’ expansion you might run it to this problem. Especially if you are using older Linux systems, or Linux running on old hardware as the argument length might have been shortened during kernel because of lack of memory.

An example command which might generate this error.

$rm *
bash: /usr/bin/rm: Argument list too long

this command should remove all files in the current director, but if the number of files are huge, you will run into argument list too long error.

To make this work u can use one of these two methods.

1. Use find command

To use find you have to make find parse though the file list and execute rm on each file one by one.

To do this the command would be.

$ find ./ -type f -exec rm {} \;

here rm is the command and {} is the parameter to the command, in find {} means the current file name.

2. Use for loop

The syntax of for can vary form shell to shell. But a generic sh syntax would be.

$ for file in $(ls -1);  do  {  rm $file } ; done

In this the $file variable contains the file name taken from the $(ls -1 ) list which the for loop loops though, and this $file variable is passed to the rm to remove.

Hope that this helps all of you who encounter this issue a lot.