NO DEFRAGMENTATION NEEDED IN LINUX

defragment in linux

We all must have heard about defragmenting our hard drives to speed up performance. Sound of that similar to windows users but we don’t have any defragment utility, hell, we don’t need to defragment! And why is that? Lets find out-

I remember when I was new to Linux, a friend of mine came with a hard disk and asked me to defragment it (yeah, we all have faced it).  It was easy in windows, how hard it could be in Linux?  I connected the spare bus to his hard disk and then started a mission to defragment via Linux. I can’t stress this enough that I was new to Linux and didn’t know much about how things work. After trying every bit I knew, looked up the mighty google and it came like a bolt from the blue- NO DEFRAGMENTATION NEEDED IN LINUX. </chitchat>

What do you mean by fragmentation of hard disk?

I’ll cover it in as short as possible; your hard disk is divided into sectors. These sectors are capable of storing small pieces of data. So, when the size of file is more than size of a sector then the file is saved over multiple sectors, as simple as that. As the new file comes, it is saved next to previous sector. But, when the size of first file increases, it might not find free sectors near original file so it will be saved few sectors apart, this goes on and on. While reading this file, the head will have to skip physical locations which ultimately will make things slower. Defragmentation is the process in which file is put back in continuous fashion so that there is no skipping of sectors.

Note: Defragmenting is not recommended for SSD drives. They have a different theory, doing so will reduce their life.

How it works in case of Linux?

Linux’s file systems deal with fragmentation in an intelligent way. Instead of placing files next to each other, it keeps a lot of space between the sectors of two files therefore leaving space for these files to grow. This keeps fragmentation far away, yet not impossible. Even if there are fragments, file system attempts to move the files thereby reducing the fragmentation. The system is designed to avoid fragmentation in normal use. You might face some fragmentation when your space fills up, may be 80% or 90%. The more suitable method to deal with it is to get a new hard drive with more space else you can copy your files to other drive, delete original files and then copy them back- they will be arranged automatically.

Linux kernel 3.6 released

It has been just two months or so since Linux 3.5 was unleashed, another update was released as Linux 3.6 on October 1st, 2012.

Torvalds said

“There haven’t been any huge new architectures or filesystems, it’s all ‘solid progress.’ That may not sound all that exciting, but the devil is in the details, and there’s a lot of small fixes all over.”

The most important and talked-about changes in Linux 3.6 are as follows:

1. Hybrid sleep

It now offers a mode which can be categorised as a hybrid of sleep mode and Hibernation. It first copies the contents of RAM on Hard Drive as it does in hibernate mode and then goes into sleep mode. What we get from this mode? The system won’t just resume quickly but no data will be lost on loosing power.

If the system power gets cut-off somehow, the system will resume from hibernated image, else the resume process will go normally as always and the hibernate image will be discarded.

2. TCP Fast Open

This feature was developed by Google, it helps in creating a TCP connection quickly in some cases. What we actually get from it? As per release notes, you will see improved page load times on popular websites. In Linux 3.6, client side is now supporting this feature. Server side coming soon.

3. Better drivers

In all Linux kernel updates, a lot of drivers are added to improve hardware support; this update is no different. This update primarily targets Sony and Apple devices.

4. Better memory management

Several changes were made for the betterment of memory management, a new feature is introduced which allows swap read-ahead IOPS (input/output operations per second) which promises more throughput along with lower CPU utilization.

Another good news is that now you can enjoy playing casino games online from your home. For that you can go to PartyCasino. You’ll love it, and perhaps you will win some money too! So try it now. Have a good day!

How to display a digital clock in Linux terminal?

 

A clock is nothing special, we have tons of it but when it comes to linux the joy of accomplishing anything on command line is heavenly. In this document we are going to see how to display a digital clock in terminal (which updates). You can see the current data/time with Linux’s default command date. We will be playing with this very command to do the intended. To retrieve only the time from date command, we can add “+%r” or “+%T”    to date command.

 

With this “data” command you can print the system time. The logic behing building a digital clock is to get continuos output.  One way to do this is to use “watch” command along with “date” command. Thus to get a continuous digital clock you can execute following code:

watch -n 1 date +%r

 

You will find following result:

 

date linuxstall

 

Now, if you want a clear and formatted output of current time then you can go for this second method. This time we are going to use “echo” command  to display the date and in addition to that, we will put it in infinite loop which will update every 1 second- giving a feel of continuous digital clock.

The code goes like this:

clear; while true; do echo -e \\b\\b\\b\\b\\b\\b\\b\\b`date +%T`\\c ; sleep 1; done

 

You will see something similar to this:

 

 

 

 

Lets break our code down:

 

“echo” is used for displaying the output of “date” command.

\\b is to delete the previous output. We have used “%T “ with date which gives 8 characters long output. That is why we have used \\b 8 times. In case you wish to use “%r”, you will have to use \\b for 11 times as it produces detailed output.

\\c is used to check “echo” from creating new line.

How to update twitter from Pidgin?

update twitter from pidgin

Pidgin is one of the best chat client available on Linux (and on Windows as well). Most Linux distros are shipping with pre-installed Pidgin as default chat client. The major advantage of using Pidgin is that it supports multiple protocols. One can chat on Facebook, gmail, irc, AIM, yahoo, etc. from the single window. Pidgin has gathered all the platforms together but Twitter. Here we are fixing that up! (Credit goes to developer)

We can use a plug-in called “pidgin-microblog” which will enable the twitter integration with Pidgin. Post installation you can update or get twitter-feed from the very Pidgin. Not just Twitter but Identi.ca, status.net, etc. With this plug-in, You get a notification when you have a new update in twitter.

If you are on debian based distro then you can always fire up thet terminal and run following command to install the plug-in.

 

sudo apt-get install pidgin-microblog

 

Once you are done with the installation, go to “Accounts” and select “Manage Account”. Then click on “Add” which will navigate you to “Add accounts” window. Select “TwitterIM” and you are very much done.

Last thing you need to do is to authenticate yourself and you can go tweeting all you want right from you little Pidgin.

 

Linux doesn’t need no antivirus. A Myth!

linux antivirus

First advantage over Windows which every one claims is, Linux is free from virus so it doesn’t need any antivirus…WRONG!

Don’t live in a ‘fool’s paradise’, they also have Linux in their sights!
Only problem is, there are so many distros, they don’t know where to start…lol!

 

Jokes apart, Linux antivirus products do exist, its just that the number is far too low when compared to those of Windows. Have a look at few major reasons behind this:

  • Why would a virus writer spend a considerable amount of time is writing a virus which no one (read: less) would notice? Attention is all they want. Since the major market share is acquired by Windows users so it is the first choice to hit upon.
  • In comparison to Linux users, windows users are more prone to committing mistakes and allowing virus to damage their systems.
  • This is quite debatable but it’s true that Windows has more exploitable security loop holes.
  • If a loop hole is discovered in Linux, it is patched before anyone notices. The code is analyzed and updated by a large number of programmers due to its open source nature, in comparison to windows.

It would not be correct to say Linux machines are never infected; they are vulnerable to “rootkit”. Rootkits allow attacker to get top level access to victim’s machine and have full control and during attack user is never alerted about this. Rootkit can spy or modify data and even run applications in background. Some other threats to Linux machines are poisoned DNS entries, spam gateways, backdoor botnets, etc.

You can have a look over the list of viruses here:
http://en.wikipedia.org/wiki/List_of_Linux_computer_viruses#Threats

Microsoft blocks Chrome and Firefox in Windows 8

Microsoft blocks chrome and firefox on windows 8

You can listen to high pitch cries of Microsoft with this attempt to save Internet Explorer from hitting the dumps. It tends to do so by not improving own product but suppressing others making use of its monopolistic position. This time they are restricting competitor browsers like Firefox and Chrome in ARM version of Windows 8. It is called RT edition of Windows 8. Its in news already that they restricted linux from booting on their hardware.

Mozilla made a claim on their blog that “Windows RT will have two environments, a Windows Classic environment and a Metro environment for apps. However, Windows on ARM prohibits any browser except for Internet Explorer from running in the privileged ‘Windows Classic’ environment.”

Mozilla made another point, “What it means that only Internet Explorer will be able to perform many of the advanced computing functions vital to modern browsers in terms of speed, stability, and security to which users have grown accustomed. Given that IE can run in Windows on ARM, there is no technical reason to conclude other browsers can’t do the same.”

Microsoft blocks chrome and firefox on windows 8
Image from: ZDNet

 

Looks like Microsoft trying to block them only because it can’t beat them!

Kubuntu breaks up with Canonical, Blue Systems is the new sponsor

Kubuntu found new home. Kubuntu will now no longer be sponsored by Canonical. The new sponsor of Kubuntu will be Blue Systems. Blue Systems has been there for other KDE projects as well as distros, LinuxMint and NetRunner. They would have to deal with trademark issues which might lead to change in name. If KDE were to acquire a spot in enterprise solution, a new name and branding is what it needs.

Jonathan Riddel said:

“With this new sponsorship we will have the independence to give the project new wings and take the excellent KDE Software to new audiences,”

(Source)

Not so appreciated attitude of Dr. Richard Stallman

DO NOT USE FACEBOOK!

On a mailing list MIT CSAIL, a thread was started by some students asking for votes over facebook as they were competing for a chance to win $100K.

Hi all,

A few MIT current students and alumni (previously on the GPI action team)
are working on an exciting project to help *MIT students and international
development volunteers*! We are competing on Facebook and if we get enough
votes (if we can make 5th place or higher) we have the chance to win $100K!
*It takes 1 minute to vote on Facebook and you can disable the app
immediately after voting!*

We are building *an International Development Project Database and Mentor
Connection** *that gathers detailed information about international service
projects. Future students and volunteers will be able to build upon
previous work (use previous designs, materials) instead of starting from
scratch. Experts and previous volunteers will help students form their
projects and prepare for on the ground work in specific regions.*We would
extremely appreciate your vote!*

Dr. Stallman response tells us that he hates facebook from all his heart. His response can be checked here. He said:

Facebook is not your friend. Its “real name” policy is enough reason to refuse to use it, but there is so much more nastiness in Facebook. I don’t use it, and you shouldn’t either.

He even said:

Facebook is an international parasitism project.

Read full reply here.

He brought up pretty strong points to justify his hatred. What do you say? Leave comments.

How to install eclipse in Linux (CentOS, RHEL, Fedora)

how to install eclipse in linux

Eclipse is an integrated development ennvironment primarily for Java but with the extra plugins it can also be used to develop applications in C, C++, PHP, Scala, etc.

Here we are explaining How to install eclipse on linux. Distros covered are Fedora, CentOS and RHEL.

Download Eclipse

Go to www.eclipse.org/downloads/ and select suitable version according to your needs.

Switch to root

 su - 

Extracting

We are extracting the Eclipse package into /opt directory.

 tar -xvzf eclipse-SDK-3.7.2-linux-gtk.tar.gz -C /opt 

Adding read permissions

 chmod -R +r /opt/eclipse 

Creating executable

touch /usr/bin/eclipse 
chmod 755 /usr/bin/eclipse 
gedit /usr/bin/eclipse

Paste following code in the file.

 #!/bin/sh
export ECLIPSE_HOME="/opt/eclipse" 
$ECLIPSE_HOME/eclipse $*

You are done!

Beginners guide to Linux directory structure

Have you ever looked in your / directory, you’ll see a lot of directories. Here we are presenting beginners guide to linux directory structure explaining what they mean and what are the contents of these directories.

Screenshot of contents of root directory:

linux directory structure

 

/

This is called root partition. All files and directories start with root partition. Write privileges under this directory are avaible with root user only. Not to confuse it with root user’s home directory, know the difference, “/” is root partition while root user’s home directory is “/root”.

/bin

This directory has binary executable files. Linux commands used in single user mode are found in this directory. It also holds commands that are used by all users. Examples: ls, ping, cp.

/sbin

Like /bin, /sbin also contains binary executable files but the commands held by this directory are used by system administrators with the prime purpose of system maintenance. Examples: iptables, reboot, fdisk.

/etc

It holds all the configuration files which are required by all programs. Shell scripts needed by programs to start or stop them are held by this very directory. Examples are /etc/resolv.conf, /etc/logrotate.conf

/dev

/dev contains device files. In Linux, everything is a file. Included are terminal device or usb or any other device connected to the computer. For example: /dev/usbmon0

/proc

All the system process information is held in /proc. It is a pseudo filesystem as it contains information about running processes. For an instance, /proc/ is the directory which holds information of the process with . It contains information about the system resources. /proc/uptime is one such directory.

/var

var denotes variable files. Those files are kept in this directory that are supposed to grow. Some of the files that reside in here are- /var/log (system log files), /var/lib (package files), /var/mail (emails), /var/spool (print queues), /var/tmp (temporary files that are needed across reboots).

/tmp

System generated and user generated temporary files are kept in this category. Important files should not be saved in here because contents of /tmp are flushed every time system boots.

/usr

/usr is the one that holds user programs. It contains documentations, libraries and source-code for all the second level applications. /usr/bin holds binaries for user programs. While looking for a binary after /bin also look in /usr/bin. Examples of binaries you mighht find in /usr/bin are awk, less, cc. Similarly binary files for system administrators are kept in /usr/sbin. Examples are cron, sshd, useradd. Libraries for /usr/bin and /usr/sbin are kept in /usr/lib. /usr/local holds user programs that a user installs from source.

/home

All user’s personal files are kept in their respective home directories.

/boot

This directory has boot loader files. While booting, files needed are found in /boot. Kernel initrd, grub and few more files reside in this directory.

/lib

Binaries located in /bin and /sbin are supported by library files kept in /lib. Library nomenclature goes like ld* or lib*.so.* . For example: ld-2.11.1.so

/opt

/opt is for add-on optional applications from individual vendors. All applications that are optional should be installed in /opt or any of its subdirectory.

/mnt

/mnt is our mount directory. It is the temporary mount location where where system administrators can mount temporary filesystems.

/media

It serves as the temporary mount point for removable devices. All removable devices are mounted in this directory. Example: /media/cdrom or /media/floppy.

/srv

srv denotes service. All the service related data used for servers is saved in this directory.