Friday, July 30, 2010

Why Linux is Better Than Windows

Our Linux Top 10 Reasons


  1. Security - Linux is Open Source Software, while Windows is not. The simplest benefits of Open Source Code to demonstrate are increased security, reliability and functionality; because users of Open Source are readily able to identify and correct problems with the programs and to submit their own enhancements for incorporation into the program. Closed Source systems enjoy none of those benefits.
  2. Scalability - Systems implemented under Linux can be cloned limitless times without paying additional software licensing fees - With Windows, you pay for each installation/workstation/server/cpu.
  3. Power - Linux is made with the Unix design philosophy, which dictates that system tools are small and highly specialized. The result is an incredibly powerful and reliable system, limited in capability only by the user's imagination and ability to integrate the Unix utilities. The Windows philosophy is to create unwieldy swiss army knives, limited in capability by how many features the user purchased on their particular knife. Diminished reliability is arguably a side effect of increased complexity. Thus with Windows, the case is often that you have tools that ALMOST do what you want them to, if they didn't crash.
  4. Reliability - The architecture of Linux is superior to Windows because critical operation system functions are implemented in such a way that buggy programs can't cause the computer to become unstable and crash. In fairness, though not quite as robust as Linux, Windows 2000 and Windows XP are much improved over Windows 9x and Windows Millenium Edition.
  5. Advanced Capabilities - In addition to the system utility tools from the Unix world, Linux usually comes with the Apache Webserver, an email server, router/firewall capabilities and SQL databases. These are extras costing up to thousands of dollars on Windows. There IS free software to do these jobs on Windows, but it has mostly been adapted from Linux and loses some functionality when ported to Windows.
  6. Compatibility - Linux is POSIX Compliant which means that applications developed for Linux can be operated on other POSIX compliant Unix derivatives with a minimum of reworking.
  7. Support - For persons not familiar with the Open Source Community, the quality of free technical support on the internet may come as a shock. Sometimes knowing enough to ask the right questions can be a problem, but overall the best and the brightest are there to assist you at no charge when you run into problems that can't be solved by reading the documentation included with Linux. With Windows or other commercial software, your manufacturer support is only free for a limited time and is often of little value anyways.
  8. Not Single Source Software - Linux is distributed by several companies, giving consumers to pick and choose the flavor that best suits their needs. Windows is the product of a single company, Microsoft Corporation. Windows users have no choice but to accept what Microsoft offers.
  9. Rate of Advancement - Linux has and will continue to advance at a rate impossible for a close development project such as Microsoft Windows to sustain. A few factors driving this rate of progress are (in no particular order): the number of active developers; quantity and quality of feedback from the field; short development cycle from development team to the end user; absence of corporate "meddling" in the design process; independently developed open source subsystems frequently incorporated into Linux, giving it quantum advances in a short time.
  10. Cost - That Linux is FREE deserves honorable mention and a bit of explanation. You can package and sell Linux for money. The competing Linux distributions all provide slightly different feature sets beyond the core system, including canned e-commerce solutions, printed manuals and phone support options. There is no rule that says you can't make money distributing Linux. For those who choose to download and install free distributions from the Internet, Linux is truely free. Some cynics have proclaimed, "Sure Linux is free now, but the Linux People will start charging for it once it catches on!". That statment is completely false. No single person or organization controls Linux, so that will never happen. In the unlikely case that Linus Torvalds (the author of Linux) adds some proprietary code and proclaims that all future releases will be $99.99USD, someone will simply take the latest "free" version and possibly rename it to Spin-UX. Then all the volunteer developers and contributors will jump on that bandwagon. Spin-UX will diverge from its Linux roots, over time becoming better supported and more advanced, rendering its ancestor obsolete, except possibly for purposes specifically addressed by that hypothetical proprietary added code. Furthermore Linux is covered by the Gnu Public License, stating that it and all derivative works must be distributed with the source code. This makes it extremely unlikely that anyone will wield monopolistic power in the Linux Sector.

To conclude this hopefully persuasive bit of Linux Advocacy, it must be stated that an Operating System without suitable Applications is of little use. There are free web browsers and email clients for Linux, as well as the free Star Office product from Sun Microsystems. Star Office includes the traditional productivity applications: Word Processing, Spreadsheet and Database. Corel Office is also available for Linux at little or no charge.

As more small businesses adopt Linux, the number of Indepdendent Software Vendors offering industry specific (Vertical Market) applications will increase. As I learn of business applications designed for Linux, I will document them on this site.

Saturday, July 10, 2010

Mounting Linux Partitions in Ubuntu

If you plug in an external hard drive with a Linux filesystem, it will automount and show up on your desktop, just like any external media. But what if you have an internal hard drive or partition with a Linux filesystem? Well, that's what this tutorial is about.

Warning: The tutorial on this page is for an internal drive that will serve as an extra data partition. If you would like to mount a separate drive or partition as /home instead, you want a different tutorial.

First you have to determine what the partition is called and what filesystem it is. One quick way to do it if you know what filesystem you formatted the drive as (Ext3, for example) is to just type the terminal command

sudo fdisk -l

Here's how it could come out:

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000eb4ba

Device Boot Start End Blocks Id System
/dev/sda1 * 1 524 4208006 83 Linux
/dev/sda2 525 1044 4176900 83 Linux

As you can see, I'm able to locate that /dev/sda2 is my Linux partition, but in System, I don't find out if it's Ext3, Ext4, Reiserfs, or what it is. If I happen to know it's Ext4, cool.

But let's say I didn't know. Well, one way to find out for sure is to install GParted and find out:

sudo apt-get update
sudo apt-get install gparted gksu
gksudo gparted


You can go to System > Administration > GParted and enter your password to get it started.


Ah, now I can definitely see it's Ext4 for sure. Under Partition I see it's /dev/sda2, and under Filesystem, I see it's Ext4.

If you have a second physical hard drive (not just another partition), you might have to click on the top-right corner to focus on the second hard drive. (Click on the down-pointing arrow to get the drop-down menu.)

So now I'll create a mount point for that partition:

sudo mkdir /storage

Next, I want to determine the UUID of my partition.***

ls -l /dev/disk/by-uuid
and I get back this output:
total 0
lrwxrwxrwx 1 root root 10 2010-04-26 12:00 20bfd80a-a96b-461c-a63d-c96ff8e95872 -> ../../sda1
lrwxrwxrwx 1 root root 10 2010-04-26 19:19 d1d0cf46-958f-4a12-a604-0ac66040648b -> ../../sda2
Then I'll edit my /etc/fstab file:
sudo cp /etc/fstab /etc/fstab_backup
sudo nano /etc/fstab

Once in there, I should add in this line:

UUID=d1d0cf46-958f-4a12-a604-0ac66040648b /storage ext4 defaults 0 0

Then I can save (Control-X), confirm (Y), and exit (Enter).

Since we've made changes to the /etc/fstab file, we need to have Ubuntu acknowledge those changes:

sudo mount -a

Now I need to give it the proper permissions. Let's just assume, for this example, that my username is jessica.

sudo chown -R jessica:jessica /storage
sudo chmod -R 755 /storage

Now the partition is mounted in the /storage folder and is ready for use!

*** Yes, I could just use the name of it (/dev/sda2), but UUID is more precise. It's unlikely that I'll unplug my internal drive, plug in a new internal drive, and then plug back in my original internal drive so that the partition names are reassigned. Still, it's safer to use the exact partition identifier in /etc/fstab.


Command Line Partitioning

You'll be using "fdisk" to accomplish this. Refer back to the logical name you noted from earlier. For illustration, I'll use /dev/sdb, and assume that you want a single partition on the disk, occupying all the free space.

If the number of cylinders in the disk is larger than 1024 (and large hard drives always have more), it could, in certain setups, cause problems with:

  1. software that runs at boot time (e.g., old versions of LILO)
  2. booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)

Otherwise, this will not negatively affect you.

1) Initiate fdisk with the following command:

  •   sudo fdisk /dev/sdb 

2) Fdisk will display the following menu:

  •   Command (m for help): m 
    Command action
    a toggle a bootable flag
    b edit bsd disklabel
    c toggle the dos compatibility flag
    d delete a partition
    l list known partition types
    m print this menu
    n add a new partition
    o create a new empty DOS partition table
    p print the partition table
    q quit without saving changes
    s create a new empty Sun disklabel
    t change a partition's system id
    u change display/entry units
    v verify the partition table
    w write table to disk and exit
    x extra functionality (experts only)

    Command (m for help):

3) We want to add a new partition. Type "n" and press enter.

  Command action
e extended
p primary partition (1-4)

4) We want a primary partition. Enter "p" and enter.

  Partition number (1-4):

5) Since this will be the only partition on the drive, number 1. Enter "1" and enter.

  Command (m for help):

If it asks about the first cylinder, just type "1" and enter. (We are making 1 partition to use the whole disk, so it should start at the beginning.)

6) Now that the partition is entered, choose option "w" to write the partition table to the disk. Type "w" and enter.

  The partition table has been altered!

7) If all went well, you now have a properly partitioned hard drive that's ready to be formatted. Since this is the first partition, Linux will recognize it as /dev/sdb1, while the disk that the partition is on is still /dev/sdb.

Command Line Formatting

To format the new partition as ext3 file system (best for use under Ubuntu):

  •   sudo mkfs -t ext3 /dev/sdb1

To format the new partition as fat32 file system (best for use under Ubuntu & Windows):

  •   sudo mkfs -t fat32 /dev/sdb1

As always, substitute "/dev/sdb1" with your own partition's path.

Modify Reserved Space (Optional)

When formatting the drive as ext2/ext3, 5% of the drive's total space is reserved for the super-user (root) so that the operating system can still write to the disk even if it is full. However, for disks that only contain data, this is not necessary.

NOTE: You may run this command on a fat32 file system, but it will do nothing; therefore, I highly recommend not running it.

You can adjust the percentage of reserved space with the "tune2fs" command, like this:

 sudo tune2fs -m 1 /dev/sdb1

This example reserves 1% of space - change this number if you wish.

  • {i} Using this command does not change any existing data on the drive. You can use it on a drive which already contains data.

Create A Mount Point

Now that the drive is partitioned and formatted, you need to choose a mount point. This will be the location from which you will access the drive in the future. I would recommend using a mount point with "/media", as it is the default used by Ubuntu. For this example, we'll use the path "/media/mynewdrive"

  •   sudo mkdir /media/mynewdrive

Now we are ready to mount the drive to the mount point.

Mount The Drive

You can choose to have the drive mounted automatically each time you boot the computer, or manually only when you need to use it.

Automatic Mount At Boot

You'll need to edit /etc/fstab:

  •   gksu gedit /etc/fstab

Add this line to the end (for ext3 file system):

  •   /dev/sdb1    /media/mynewdrive   ext3    defaults     0        2

Add this line to the end (for fat32 file system):

  •   /dev/sdb1    /media/mynewdrive   vfat    defaults     0        2
    The defaults part may allow you to read, but not write. To write other partition and FAT specific options must be used. If gnome is being used, use the right-click, mount method. Then launch the mount command from terminal, no options. The last entry should be the FAT drive and and look something like:
      /dev/sda5 on /media/mynewdrive type vfat
  • (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)

  • All of the parts between the parenthesis are the mount options and should replace "defaults" in the fstab file. The "2" at the end instructs your system to run a quick file system check on the hard drive at every boot. Changing it to "0" will skip this. Run 'man fstab' for more info here.

You can now run "sudo mount -a" (or reboot the computer) to have the changes take effect.

If you want to allow a normal user to create files on this drive, you can either give this user ownership of the top directory of the drive filesystem: (replace USERNAME with the username)

  •   sudo chown -R USERNAME:USERNAME /media/mynewdrive

or in a more flexible way, practical if you have several users, allow for instance the users in the plugdev group (usually those who are meant to be able to mount removable disks, desktop users) to create files and sub-directories on the disk:

  •   sudo chgrp plugdev /media/mynewdrive
    sudo chmod g+w /media/mynewdrive
    sudo chmod +t /media/mynewdrive

The last "chmod +t" adds the sticky bit, so that people can only delete their own files and sub-directories in a directory, even if they have write permissions to it (see man chmod).

Manually Mount

Alternatively, you may want to manually mount the drive every time you need it.

For manual mounting, use the following command:

sudo mount /dev/sdb1 /media/mynewdrive 

When you are finished with the drive, you can unmount it using:

sudo umount /media/mynewdrive
That's it :)


Wednesday, July 7, 2010

List of commands determine system info/resources/partitions/process in Ubuntu Linux

Following lists frequently-used commands to determine ubuntu info,resources,partitions,network,process and so on.First,open terminal from Applications/Accessories/Terminal and type the commands.

System infomation

uname -a
#kernel/operating system/CPU info in brief.
head -n 1 /etc/issue
#see the ubuntu version,same tocat /etc/issue
hostname
#hostname
lspci -tv
#list all PCI devices
lsusb -tv
#list all USB devices
lsmod
#list loaded kernel modes
env
#environment variable

Resources

free -m
#see the usage of memory and swap
df -h
#the usage of partitions
du -sh
#see the size of the directory in M.
grep MemTotal /proc/meminfo
#total size of RAM
grep MemFree /proc/meminfo
#free size of RAM
uptime
#system running time,users,load average
cat /proc/loadavg
#load average

Disk and Partition

mount | column -t
#mount info about partitions
fdisk -l
#list all partitions,need root permission
swapon -s
#list all swap partitions
hdparm -i /dev/sda
#list disk info (only for IDE)

Network

ifconfig
#list IP informations
route -n
#list route tables
netstat -lntp
#list listening ports
netstat -antp
#list established links

Process

ps -ef
#list all processes
top
#list processes and usage of system resource

User

id username
#list the user info.
last
#list login record
cut -d: -f1 /etc/passwd
#list all users
cut -d: -f1 /etc/group
#list all groups
crontab -l
#list scheduled tasks of current user

Service

chkconfig --list
#list all services
chkconfig --list | grep on
#list all running services

Edit PDF on Ubuntu with PDF Editor

PDFedit is free and open source library for manipulating PDF documents, released under terms of GNU GPL version 2. It includes PDF manipulating library based on xpdf, GUI and set of command line tools.
Multiplatform library working on Unix systems, Windows32/64 and also Windows CE and others. You can use it to read, change and extract information from a PDF file. It is based on xpdf library.Graphical interface based on QT3.x which heavily depends on scripting; therefore, any user can modify the behaviour by scripts and plugins.

Ubuntu user can easily install PDFedit by this command:

sudo apt-get install pdfedit

Check your Hardware/System infomation in Ubuntu with Hardinfo

HardInfo can gather information about your system’s hardware and operating system, perform benchmarks, and generate printable reports either in HTML or in plain text formats.
It can also be easily extended, for developer documentation and full source code (released under GNU GPL version 2) is available.

To install Hardinfo,just click:

apt:hardinfo

and launch hardinfo from Applications->System Tools->System Profiler and Benchmark

Add a User in Ubuntu

useradd

The useradd command will let you add a new user easily from the command line:

useradd

This command adds the user, but without any extra options your user won’t have a password or a home directory.

You can use the -d option to set the home directory for the user. The -m option will force useradd to create the home directory. We’ll try creating a user account with those options, and then use the passwd command to set the password for the account. You can alternatively set a password using -p on the useradd command, but I prefer to set the password using passwd.

sudo useradd -d /home/testuser -m testuser

sudo passwd testuser

This will create the user named testuser and give them their own home directory in /home/testuser. The files in the new home directory are copied from the /etc/skel folder, which contains default home directory files. If you wanted to set default values for your users, you would do so by modifying or adding files in that directory. If we take a look at the new home directory for the user:


geek@ubuntuServ:/etc/skel$ ls -la /home/testuser
total 20
drwxr-xr-x 2 testuser testuser 4096 2006-12-15 11:34 .
drwxr-xr-x 5 root root 4096 2006-12-15 11:37 ..
-rw-r–r– 1 testuser testuser 220 2006-12-15 11:34 .bash_logout
-rw-r–r– 1 testuser testuser 414 2006-12-15 11:34 .bash_profile
-rw-r–r– 1 testuser testuser 2227 2006-12-15 11:34 .bashrc


You’ll notice that there are bash scripts in this directory. If you wanted to set default path options for all new users, you would do so by modifying the files in /etc/skel, which would then be used to create these files by the useradd command.

adduser :-

The adduser command is even easier than the useradd command, because it prompts you for each piece of information. I find it slightly funny that there are two virtually identically named commands that do the same thing, but that’s linux for you. Here’s the syntax:

adduser

Example:

geek@ubuntuServ:/etc/skel$ sudo adduser thegeek
Password:
Adding user `thegeek’…
Adding new group `thegeek’ (1004).
Adding new user `thegeek’ (1004) with group `thegeek’.
Creating home directory `/home/thegeek’.
Copying files from `/etc/skel’
Enter new UNIX password:
Retype new UNIX password:
No password supplied
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for thegeek
Enter the new value, or press ENTER for the default
Full Name []: The Geek
Room Number []: 0
Work Phone []: 555-1212
Home Phone []: 555-1212
Other []:
Is the information correct? [y/N] y

Friday, July 2, 2010

Recover root password under linux with single user mode

It happens sometime that you can't remember root password. On Linux, recovering root password can be done by booting Linux under a specific mode: single user mode.
This tutorial will show how to boot Linux in single user mode when using GRUB and finally how to change root password.

During normal usage, a Linux OS runs under runlevels between 2 and 5 which corresponds to various multi-user modes. Booting Linux under runlevel 1 will allow one to enter into a specific mode, single user mode. Under such a level, you directly get a root prompt. From there, changing root password is a piece of cake.

1. Entering runlevel 1

Some Linux distribution, such as Ubuntu for instance, offer a specific boot menu entry where it is stated "Recovery Mode" or "Single-User Mode". If this is your case, selecting this menu entry will boot your machine into single user mode, you can carry on with the next part. If not, you might want to read this part.

Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:

  • use the arrows to select the boot entry you want to modify.
  • press e to edit the entry
  • use the arrows to go to kernel line
  • press e to edit this entry
  • at the end of the line add the word single
  • press ESC to go back to the parent menu
  • press b to boot this kernel

The kernel should be booting as usual (except for the graphical splash screen you might be used to), and you will finally get a root prompt (sh#).

Here we are, we have gained root access to the filesystem, let's finally change the password.

2. Changing root password

As root, changing password does not ask for your old password, therefore running the command:

# passwd

will prompt you for your new password and will ask you to confirm it to make sure there is no typo.

That's it, you can now reboot your box and gain root access again

Thursday, July 1, 2010

Ubuntu 10.04 “Lucid Lynx” Torrent Link Collection

If you haven’t yet upgraded to Ubuntu 10.04 I would invite you to use one of the torrent links below. Please remember to share at least to a 1:1 ratio, but more if you can. The more the seed, the faster everyone else gets their downloads:

Ubuntu 10.04

ubuntu-10.04-alternate-amd64.iso.torrent

ubuntu-10.04-alternate-i386.iso.torrent

ubuntu-10.04-desktop-amd64.iso.torrent

ubuntu-10.04-desktop-i386.iso.torrent

ubuntu-10.04-netbook-armel+dove.img.torrent

ubuntu-10.04-netbook-armel+imx51.img.torrent

ubuntu-10.04-netbook-i386.iso.torrent

ubuntu-10.04-server-amd64.iso.torrent

ubuntu-10.04-server-i386.iso.torrent

Kubuntu 10.04

kubuntu-10.04-alternate-amd64.iso.torrent

kubuntu-10.04-alternate-i386.iso.torrent

kubuntu-10.04-desktop-amd64.iso.torrent

kubuntu-10.04-desktop-i386.iso.torrent

kubuntu-10.04-netbook-i386.iso.torrent

Mythbuntu 10.04

mythbuntu-10.04-desktop-amd64.iso.torrent

mythbuntu-10.04-desktop-i386.iso.torrent

Ubuntu Studio 10.04

ubuntustudio-10.04-alternate-amd64.iso.torrent

ubustustudio-10.04-alternate-i386.iso.torrent

Xubuntu 10.04

xubuntu-10.04-alternate-amd64.iso.torrent

xubuntu-10.04-alternate-i386.iso.torrent

xubuntu-10.04-desktop-amd64.iso.torrent

xubuntu-10.04-desktop-i386.iso.torrent

Save Bandwidth With Multiple Machines with Apt-Cacher in Ubuntu

Apt-cacher :-

“Apt-cacher performs caching of .deb packages which have been downloaded by local users. When a package is requested, the cache checks whether it already has the latest version, in which case it sends the package to the user immediately. If not, it downloads the package while streaming it to the user at the same time. A local copy is then kept for use by other users.”

Apt-Cacher will allow you to centrally cache any updates or installed packages on a central machine and help you save bandwidth. No matter if you have two Ubuntu machines or twenty, as far as your bandwidth is concerned your ISP will only think you have one! Below are steps for setting up Apt-Cacher.

First, of course, we’ll need to install it (it only needs to be installed on one central machine).

$ sudo apt-get install apt-cacher

To test that it is installed correctly you can try visiting the address below:

http://[localhost]:3142/ or http://[LOCAL.IP]:3142/

If you see the Apt-Cacher page the server end of things are setup. There are a few other things you can tweak, and you’ll probably want to take a look at a few configuration options such as allowed_hosts and denied_hosts. You can edit these settings in the /etc/apt-cacher/apt-cacher.conf

allowed_hosts=192.168.0.0/24 (to allow all local machines)

denied_hosts=

You also need to configure Apt-Cacher to “go live” so you’ll need to change one more option in another file. Simply change the AUTOSTART within /etc/default/apt-cacher from 0 to 1.

sudo vim /etc/default/apt-cacher

AUTOSTART=0

to

AUTOSTART=1

And one last option to run on the server machine is to import any existing .deb packages on that machine into the Apt-Cache database. Use the following command to import your current cache:

sudo /usr/share/apt-cacher/apt-cacher-import.pl /var/cache/apt/archives


After you’ve made any of these changes to the apt-cacher.conf file you’ll need to restart Apt-Cacher by using:

$ sudo /etc/init.d/apt-cacher restart

The next thing to do is simply point your other local machines to this central machine instead of the central repositories. You’ll want to first backup your original sources.list using the command:

$ sudo cp /etc/apt/sources.list /etc/apt/sources.list-backup

And then simply edit your the file to look something more like:

deb http://[LOCAL.IP]:3142/archive.ubuntu.com/ubuntu/ edgy main restricted
deb http://[LOCAL.IP]:3142/archive.ubuntu.com/ubuntu/ edgy universe multiverse
deb http://[LOCAL.IP]:3142/archive.ubuntu.com/ubuntu/ edgy-updates main restricted
deb http://[LOCAL.IP]:3142/archive.ubuntu.com/ubuntu/ edgy-updates universe multiverse
deb http://[LOCAL.IP]:3142/archive.ubuntu.com/ubuntu/ edgy-security main restricted
deb http://[LOCAL.IP]:3142/archive.ubuntu.com/ubuntu/ edgy-security universe multiverse
You’ll notice that I’ve simply prefixed archive.ubuntu.com with the local network address of the machine running Apt-Cacher and specified the default port. This is a broken down version of a sources.list for the sake of space. From there on everything should run the same as normal.


Now you can give things a spin by checking for updates as normal.

$ sudo apt-get update

Everything should appear as normal. Remember you can also continue to use this to install individual packages on each machine. Not all the machines need to carry the same either. Whatever is requested from any machine will be checked on the Apt-Cacher server and retrieved if it isn’t yet available.

Install FONTS in UBUNTU only in 3 steps.

step 1 :- Download FONTS From Internet.

step 2 :- Copy & Paste the FONTS in

/usr/share/fonts/truetype.

step 3 :- Run This Command

$ sudo fc-cache -f -v

Restore UBUNTU grub after installing Windows

step 1 :- boot from live ubuntu CD

step 2 :- go to commend prompt & type..

$ sudo grub

$ find /boot/grub/stage1

step 3 :- See the output & copy the grub partition no.

example..

(hd0,1)

step 4 :- Type root (hd?,?) & paste the partition no here.


step 5 :- setup (hd0)

step 6 :- quit

step 7 :- restart the computer