Dec 28, 2009

Dbus error while mounting

error:
unable to mount DBus error mount -t ntfs-3g

solution:
sudo mount -t ntfs-3g /dev/sdb1 /yourplace/ -o force

Dec 25, 2009

why my ubuntu net connection is slow?? how to fix

1) Change Firefox settings

* In firefox, type on the web browser's address box: about:config
* Find this phrase network.dns.disableIPv6
* Change its value to "true"
2) IPV6 settings
* Start a shell prompt
* Type -> sudo gedit /etc/modprobe.d/aliases
* Find this phrase: alias net-pf-10 ipv6 and comment this line as: # alias net-pf-10 ipv6
* Add this phrase under your commented line: alias net-pf-10 off
3) Restart your computer

Test your internet speed

Test your internet speed:

http://www.speedtest.net/

Dec 21, 2009

I love linux

1. I can extract something with one command without opening a separate program.

tar xjvf cornbread.tar.bz2

2. I can print a document without opening it.

http://tldp.org/HOWTO/Printing-Usage-HOWTO-2.html

3. I can update all applications with two magical words, apt-get upgrade.

apt-get upgrade

4. Its free

Download here: http://www.linux.org/dist/download_info.html

5. Its free as in beer.

6. Its more secure than Windows

Look : http://wiki.answers.com/Q/Why_is_Linux_more_secure_than_Windows

7. I can run on pretty much any hardware.

8. It is highly scalable… I can install it on a 486 or a dual core.

9. Help is readily available and free of charge.

Look: http://www.linuxhelp.net/

10. Well documented

Look: http://www.linux.org/docs/

11. No need for some obscure knowledge base

Your grandma even can use =) : http://bugsanddebugs.blogspot.com/2009/11/ubuntu-for-your-grandmother.html

12. A standard help system that is actually useful (man)

Look: http://linuxmanpages.com/

13. Powerful Command Line Interface

14. Many of the best programs are available for Linux for free. ie. Apache, MySQL, ProFTPd, SSH, OpenVPN. You would have to pay hundreds if not thousands of dollars for Windows programs that accomplish the same thing. On top of that you will have to pay for support

15. No need to call a tech support center in India to activate your fully legal OS.

GNU FREE !!! http://www.gnu.org/

16. Linux can be configured to run without a GUI for max performance. This is especially useful for servers. Other operating systems don’t have this luxury.

17. It doesn’t ask me if I am sure I want to delete something….twice

rm -f -r {file-name}

18. Many of the programs are configured with a simple config file. This makes editing much easier than navigating through pages and pages of tabs and radio check boxes. You can even structure your config file with your own comments to make editing easier for you. Change something often? Put it near the top. If you switch something on and off often and it is buried behind 9 gui screens it might take you 10 5 times longer to switch it.

./configure
make
make install

19. Linux will actually give you a reason why something had an error.

20. Linux wont tell me that my automatic updates are turned off every single minute of every day.

21. When I update Linux it won’t turn on a firewall automatically without my permission (Windows XP SP3 does this) and turn on services I had previously set to disabled.

22. Linux pretty much forces you to be a “non-administrative” user.

SUDO RULLAZ!

23. You can unmount something really fast with one command. Instead of double clicking on a silly icon navigating through all the USB devices plugged in select the right one only to find out that the device you are trying to unmount cannot be unmounted at this time.

umount device

24. Depending on the distro it is a lot easier to install than Windows.

my favourite: UBUNTU

25. Linux detects and installs more drivers for my hardware than Windows.

26. Linux comes with drivers for my onboard Sata where Windows XP does not.

27. Linux comes out with a new kernel constantly. Windows comes out with one once every couple years.

kernel distros: http://www.kernel.org/

28. With Linux we can compile our own kernel so we don’t have to a wear a one size fits all hat.

Look: http://www.cyberciti.biz/tips/compiling-linux-kernel-module.html

29. You can choose which type of desktop environment you want.

KDE or GNOME ?? www.kde.org/ www.gnome.org/

30. You don’t have to worry about spyware, viruses, or worms. Even if they were prevalent they couldn’t be installed unless you did it yourself.

31. When you “end a task” in Linux it actually works.

Kill commands: http://bugsanddebugs.blogspot.com/2009/12/kill-process.html

32. You can check your CPU’s temperature without installing any software.

Look: http://www.cpanelconfig.com/how-to/how-to-monitor-cpu-temperature-in-your-linux-box/

33. The command line auto complete feature works the way you expect it to.

Try tab key button while you're on the shell prompt.

34. To list the contents of a directory I only have to use two keys instead of three (ls vs. dir).

=)

35. Linux’s CLI actually ads value to the OS.

36. I can build a computer myself and still get a good price on the retail version of Linux (free).

Kernel compilation and you'll get a lovely linux..

37. I can control my computer remotely with SSH. Windows comes with remote desktop which was not encrypted last time i checked. It also was slow and supports only a few connected users unless you pay Microsoft more money for a terminal server.

38. Linux tends not to hide details

39. I can see the OS uptime without installing some Microsoft power user program.

40. Linux comes with a program that will eject my CD-Rom. This comes in handy when making automated CD backups and other scripts.

41. Linux passwords cannot be cracked in seconds like Windows.

42. I can print an entire directory of pdfs with ‘lpr *.pdf‘. In Windows you would have to open each with Foxit Reader or the bloated Adobe Acrobat.

43. You can have really cool desktop effects that rival even OSX effects.

Try compiz: http://www.compiz.org/

44. You can choose a filesystem that better fits your needs. With Windows you have two options old out of date crappy NTFS or even more out dated FAT32.

You can see your windows files in linux but you can't even see the linux partition on
windows

45. If you loose your Linux CD or don’t feel like downloading one you can get one mailed for free (ubuntu).

46. It supports more than 3/4gb of ram without updates and hacks.

47. You can get all applications you need without opening your browser or getting out your wallet and many times they are better than commercial solutions.

Holy apt-get =)

48. It doesn’t crash… ever… Its so reliable companies have used it as dedicated router firmware.

49. You don’t have to pay more money for multiple connected users.

50. When there is a security exploit I can expect a patch the next day not the second Tuesday of every month.

With the help of: http://www.marksanborn.net/linux/50-reasons-why-i-love-linux/ for reasons..


Dec 17, 2009

A Game Programming Site

Check this out : http://www.swiftless.com/tutorials/gmaker/gmakertuts.html

Kill process

For specific command:
Step #1: First, you need to find out process PID (process id)

Use ps command or pidof command to find out process ID (PID). Syntax:
ps aux | grep processname
pidof processname

For example if process name is lighttpd, you can use any one of the following command to obtain process ID:
# ps aux | grep lighttpd

Output:

lighttpd  3486  0.0  0.1   4248  1432 ?        S    Jul31   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd 3492 0.0 0.5 13752 3936 ? Ss Jul31 0:00 /usr/bin/p

OR use pidof command which is use to find the process ID of a running program:
# pidof lighttpd

Output:

3486

Step #2: kill process using PID (process id)

Above command tell you PID (3486) of lighttpd process. Now kill process using this PID:
# kill 3486
OR
# kill -9 3486
Where,

  • -9 is special Kill signal, which will kill the process

killall command examples

DO NOT USE killall command on UNIX system (Linux only command). You can also use killall command. The killall command kill processes by name (no need to find PID):


# killall -9 lighttpd
Kill Firefox process:


# killall -9 firefox-bin


As I said earlier killall on UNIX system does something else. It kills all process and not just specific process. Do not use killall on UNIX system (use kill -9).



Dec 13, 2009

Linux File Systems Versus Windows-Based File Systems

Although similar in many ways, the Linux file system has some striking differences from file systems used in MS-DOS and Windows operating systems. Here are a few:
* In MS-DOS and Windows file systems, drive letters represent different storage devices (for example, A: is a floppy drive and C: is a hard disk). In Linux, all storage devices are fit into the file system hierarchy. So, the fact that all of /usr may be on a separate hard disk or that /mnt/rem1 is a file system from another computer is invisible to the user.

* Slashes, rather than backslashes, are used to separate directory names in Linux. So, C:\home\chris in an MS system is /home/chris in a Linux system.

* Filenames almost always have suffixes in DOS (such as .txt for text files or .doc for word- processing files). Although at times you can use that convention in Linux, three-character suffixes have no required meaning in Linux. They can be useful for identifying a file type. Many Linux applications and desktop environments use file suffixes to determine the contents of a file. In Linux, however, DOS command extensions such as .com, .exe, and .bat don’t necessarily signify an executable (permission flags make Linux file executable).

* Every file and directory in a Linux system has permissions and ownership associated with it. Security varies among Microsoft systems. Because DOS and MS Windows began as single-user systems, file ownership was not built into those systems when they were designed. Later releases added features such as file and folder attributes to address this problem.


Reference: Negus, Linux Bible 2007

Working with the Linux File System

The Linux file system is the structure in which all the information on your computer is stored.Files are organized within a hierarchy of directories. Each directory can contain files, as well as other directories.

If you were to map out the files and directories in Linux, it would look like an upside-down tree. At the top is the root directory, which is represented by a single slash (/). Below that is a set of common directories in the Linux system, such as bin, dev, home, lib, and tmp, to name a few. Each of those directories, as well as directories added to the root, can contain subdirectories. Figure illustrates how the Linux file system is organized as a hierarchy. To demonstrate how directories are connected, the figure shows a /home directory that contains subdirectories for three users: chris, mary, and tom. Within the chris directory are subdirectories: briefs, memos, and personal. To refer to a file called inventory in the chris/memos directory, you can type the full path of /home/chris/memos/inventory. If your current directory is /home/chris/memos, you can refer to the file as simply inventory.
Some of the Linux directories that may interest you include the following:
* /bin — Contains common Linux user commands, such as ls, sort, date, and chmod.
* /boot — Has the bootable Linux kernel and boot loader configuration files (GRUB).
* /dev — Contains files representing access points to devices on your systems. These include terminal devices (tty*), floppy disks (fd*), hard disks (hd*), RAM (ram*), and CD-ROM (cd*). (Users normally access these devices directly through the device files.)
* /etc — Contains administrative configuration files.
* /home — Contains directories assigned to each user with a login account.
* /media — Provides a standard location for mounting and automounting devices, such as remote file systems and removable media (with directory names of cdrecorder, floppy, and so on).
* /mnt — A common mount point for many devices before it was supplanted by the standard /media directory. Some bootable Linux systems still used this directory to mount hard disk partitions and remote file systems.
* /proc — Contains information about system resources.
* /root — Represents the root user’s home directory.
* /sbin — Contains administrative commands and daemon processes.
* /sys (A /proc-like file system, new in the Linux 2.6 kernel and intended to contain files for getting hardware status and reflecting the system’s device tree as it is seen by the kernel. It pulls many of its functions from /proc.
* /tmp — Contains temporary files used by applications.
* /usr — Contains user documentation, games, graphical files (X11), libraries (lib), and a variety of other user and administrative commands and files.
* /var — Contains directories of data used by various applications. In particular, this is where you would place files that you share as an FTP server (/var/ftp) or a Web server (/var/www). It also contains all system log files (/var/log) and spool files in /var/spool (such as mail, cups, and news). The file systems in the DOS or Microsoft Windows operating systems differ from Linux’s file structure, as the “Linux File Systems Versus Windows-Based File Systems” explains.


Reference: Negus, Linux Bible 2007

What's So Great About Linux??

Leveraging work done on UNIX and GNU projects helped to get Linux up and running quickly. The culture of sharing in the open source community and adoption of a wide array of tools for communicating on the Internet have helped Linux to move quickly through infancy and adolescence to become a mature operating system.
The simple commitment to share code is probably the single most powerful contributor to the growth of the open source software movement in general, and Linux in particular. That commitment has also encouraged involvement from the kind of people who are willing to contribute back to that community in all kinds of ways. The willingness of Linus to incorporate code from others in the Linux kernel has also been critical to the success of Linux. The following sections characterize Linux and the communities that support it.

Features in Linux
If you have not used Linux before, you should expect a few things to be different from using other
operating systems. Here is a brief list of some Linux features that you might find cool:

* No constant rebooting — Uptime is valued as a matter of pride (remember, Linux and other UNIX systems are most often used as servers, which are expected to, and do, stay up 24/7/365). After the original installation, you can install or remove most software without having to reboot your computer.
* Start/stop services without interrupting others — You can start and stop individual services (such as Web, file, and e-mail services) without rebooting or even interrupting the work of any other users or features of the computer. In other words, you should not have to reboot your computer every time someone sneezes. (Installing a new kernel is just about the only reason you need to reboot.)
* Portable software — You can usually change to another Linux, UNIX, or BSD system and still use the exact same software! Most open source software projects were created to run on any UNIX-like system and many also run on Windows systems, if you need them to. If it won’t run where you want it to, chances are that you, or someone you hire, can port it to the computer you want. (Porting refers to modifying an application or driver so it works in a different computer architecture or operating system.)
* Downloadable applications — If the applications you want are not delivered with your version of Linux, you can often download and install them with a single command, using tools such as apt, urpmi and yum.
* No settings hidden in code or registries — Once you learn your way around Linux, you’ll find that (given the right permissions on your computer) most configuration is done in plain text files that are easy to find and change. Because Linux is based on openness, nothing is hidden from you. Even the source code, for GPL-covered software, is available for your review.
* Mature desktop — The X Window System (providing the framework for your Linux desktop) has been around longer than Microsoft Windows. The KDE and GNOME desktop environments provide graphical interfaces (windows, menus, icons, and so forth) that rival those on Microsoft systems. Ease-of-use problems with Linux systems are rapidly evaporating.
* Freedom — Linux, in its most basic form, has no corporate agenda or bottom line to meet. You are free to choose the Linux distribution that suits you, look at the code that runs the system, add and remove any software you like, and make your computer do what you want it to do. Linux runs on everything from supercomputers, to cell phones, and everything in between. Many countries are rediscovering their freedom of choice and making the switch at government and educational levels. France, Germany, Korea, and India are just a few that have taken notice of Linux. The list continues to grow.

There are some aspects of Linux that make it hard for some new users to get started. One is that Linux is typically set up to be secure by default, so you need to adjust to using an administrative login (root) to make most changes that affect the whole computer system. Although this can be a bit inconvenient, trust me, it makes your computer safer than just letting anyone do anything. This model was built around a true multi-user system. You can set up logins for everyone that uses your Linux computer, and you (and others) can customize your environment however you see fit without affecting anyone else’s settings. For the same reason, many services are off by default, so you need to turn them on and do at least minimal configuration to get them going. For someone who is used to Windows, Linux can be difficult just because it is different than Windows. But because you’re reading this book, I assume youwant to learn about those differences.



Reference: Negus, Linux Bible 2007

Understanding Linux

People who don’t know what Linux is sometimes ask me if it’s a program that runs on Microsoft Windows. When I tell them that Linux is, itself, an operating system like Windows and that they can remove (or never purchase) Windows, I sometimes get a surprised reaction: “A PC can run with nothing from Microsoft on it?” The answer is yes!

The next question about Linux is often: “How can Linux be free?” While the full answer to that is a bit longer, the short answer is: “Because the people who write the code license it to be freely distributed.” Keep in mind, however, that the critical issue relating to the word “free” is “freedom,” meaning that you are free to rebuild, reuse, reconfigure, and otherwise do what you like with the code. The only major responsibility is that if you change the software, you pass it forward so that others may benefit from your work as well.

Linux is a full-blown operating system that is a free clone of the powerful and stable UNIX operating system. Start your computer with Linux, and Linux takes care of the operation of your PC and manages the following aspects of your computer:

* Processor — Because Linux can run many processes from many different users at the same time (even with multiple CPUs on the same machine), Linux needs to be able to manage those processes. The Linux scheduler sets the priorities for running tasks and manages which processes run on which CPUs (if multiple processors are present). The scheduler can be tuned differently for different types of Linux systems. If it’s tuned prop erly, the most important processes get the quickest responses from the processor. For example, a Linux scheduler on a desktop system gives higher priority to things such as moving a window on the desktop than it does to a background file transfer.

* Memory — Linux tries to keep processes with the most immediate need in RAM, while managing how processes that exceed the available memory are moved to swap space. Swap space is a defined area on your hard disk that’s used to handle the overflow of running processes and data. When RAM is full, processes are placed in swap space. When swap space is full (something that you don’t want to happen), new processes can’t start up.

* Devices — Linux supports thousands of hardware devices, yet keeps the kernel a manageable size by including only a small set of drivers in the active kernel. Using loadable modules, the kernel can add support for other hardware as needed. Modules can be loaded and unloaded on demand, as hardware is added and removed. (The kernel, described in detail a bit later on, is the heart of a Linux operating system.)

* File systems — File systems provide the structure in which files are stored on hard disk, CD, DVD, floppy disks, or other media. Linux knows about different file system types (such as Linux ext3 and reiserfs file systems, or VFAT and NTFS from Windows systems) and how to manage them.

* Security — Like UNIX, Linux was built from the ground up to enable multiple users to access the system simultaneously. To protect each user’s resources, every file, directory, and application is assigned sets of read, write, and execute permissions that define who can access them. In a standard Linux system, the root user has access to the entire system, some special logins have access to control particular services (such as Apache for Web services), and users can be assigned permission individually or in groups. Recent features such as Security Enhanced Linux enable more refined tuning and protection in highly secure computing environments.

What I have just described are components that are primarily managed by what is referred to as the Linux kernel. In fact, the Linux kernel (which was created and is still maintained by Linus Torvalds) is what gives Linux its name. The kernel is the software that starts up when you boot your computer and interfaces with the programs you use so they can communicate effectively and simply with your computer hardware.

Components such as administrative commands and applications from other free and open source software projects work with the kernel to make Linux a complete operating system. The GNU proj ect, in particular, contributed many implementations of standard UNIX components that are now in Linux. Apache, KDE, GNOME, and other major open source projects in Linux,have also contributed to the success of Linux. Those other projects added such things as:

* Graphical user interfaces (GUIs) — Consisting of a graphical framework (typically the X Window System), window managers, panels, icons, and menus. GUIs enable you to use Linux with a keyboard and mouse combination, instead of just typing commands (as was done in the old days).

* Administrative utilities — Including hundreds (perhaps thousands) of commands and graphical windows to do such things as add users, manage disks, monitor the network, install software, and generally secure and manage your computer.

* Applications — Although no Linux distribution includes all of them, there are literally thousands of games, office productivity tools, Web browsers, chat windows, multimedia players, and other applications available for Linux.

* Programming tools — Including programming utilities for creating applications and libraries for implementing specialty interfaces.

* Server features — Enabling you to offer services from your Linux computer to another computer on the network. In other words, while Linux includes Web browsers to view Web pages, it can also be the computer that serves up Web pages to others. Popular server features include Web, mail, database, printer, file, DNS, and DHCP servers.

Once Linus Torvalds and friends had a working Linux kernel, pulling together a complete open source operating system was possible because so much of the available “free” software was:

* Covered by the GNU Public License (GPL) or similar license — That allowed the entire operating system to be freely distributed, provided guidelines were followed relating to how the source code for that software was made available going forward (see http://www.gnu.org/licenses/gpl.html).

* Based on UNIX-like systems — Clones of virtually all the other user-level components of a UNIX system had been created. Those and other utilities and applications were built to run on UNIX or other UNIX-like systems.

Linux has become one of the most popular culminations of the open source software movement.But the traditions of sharing code and building communities that made Linux possible started years before Linux was born. You could argue that it began in a comfortable think tank known as Bell Laboratories.





Reference: Negus, Linux Bible 2007

Dec 13...


(13 Dec 2001 to 2009)
I remember you, Chuck Schuldiner..... I'll always remember you..

miss you pal, it's been 8 years ! you pain is still with me...

Dec 10, 2009

printf

Where specifier is the most significant one and defines the type and the interpretation of the value of the coresponding argument:
specifierOutputExample
c Charactera
d or i Signed decimal integer392
e Scientific notation (mantise/exponent) using e character3.9265e+2
E Scientific notation (mantise/exponent) using E character3.9265E+2
f Decimal floating point392.65
g Use the shorter of %e or %f392.65
G Use the shorter of %E or %f392.65
o Signed octal610
s String of characterssample
u Unsigned decimal integer7235
x Unsigned hexadecimal integer7fa
X Unsigned hexadecimal integer (capital letters)7FA
p Pointer addressB800:0000
nNothing printed. The argument must be a pointer to a signed int, where the number of characters written so far is stored.
% A % followed by another % character will write % to stdout.

Dec 8, 2009

Mounted or unmounted?

As root, you can issue the following command to view the naming combinations possible for your system:

$ ls /dev/sda*

[Output]
/dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sda6 /dev/sda7 /dev/sda8

$ df -h

[Output]
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 39G 12G 26G 31% /
tmpfs 1012M 0 1012M 0% /lib/init/rw
varrun 1012M 256K 1012M 1% /var/run
varlock 1012M 0 1012M 0% /var/lock
udev 1012M 2.8M 1009M 1% /dev
tmpfs 1012M 164K 1012M 1% /dev/shm
lrm 1012M 2.2M 1010M 1% /lib/modules/2.6.27-16-generic/volatile
/dev/sda6 39G 35G 2.4G 94% /home
/dev/sda7 29G 25G 3.2G 89% /media/disk


Listing Hardrives
$ sudo fdisk -l

Dec 5, 2009

Debian / Ubuntu linux install kernel headers package

Make sure you have updated version
$ sudo apt-get update

Search for kernel version (optional)
$ apt-cache search linux-headers-$(uname -r)

Install linux-header package
$ sudo apt-get install linux-headers-$(uname -r)

Visual Studio Keyboard Shortcuts

Playing with keyboard shortcuts is very interesting and reduce the headache of using the mouse again and again while programming with visu...