Friday, November 7, 2008

Run two (or more) desktops at the same time

Ubuntu offers the handy User Switcher applet at the top right of the desktop to switch between the desktop of two or more users. This is cleverer than it might first seem. When it’s used to switch to a second user, a new X server is started for them in addition to the existing one. You’re supposed to use the applet to switch between the two users but you can switch between X servers by holding down Ctrl + Alt and hitting F7 and F9 .

Should you need to, you can manually start your own additional X servers for users. Assuming you’ve created a new account, switch to a virtual console (this won’t work from a terminal window!), and then login as the new user.
Then type the following: $ startx -- :1

A desktop GUI will then start for the new user. To switch back to the already logged in user’s desktop, hit Ctrl + Alt + F7 . To switch to the new user’s desktop, hit Ctrl + Alt + F9 .

The above step can be repeated to create yet more concurrent desktops for other users: for example, to concurrently run a desktop for a third user, just switch to the next virtual console, login as that user, and type startx -- :2. That user’s desktop will then appear, and you can switch to other desktops as described above, and back to the third user’s desktop by hitting Ctrl + Alt + F10 .

How-To: Find missing packages with apt-file

apt-file is a command line tool for searching packages in Debian/Ubuntu repositories.
Unlike apt-cache search, apt-file can find files in uninstalled or can list the content of uninstalled packages.

This tutorial will show how to install apt-file, update and search or list packages and files.

Have you ever search which package contains a certain file. One could use:

dpkg -S /path/to/file

This will do the job unless the package is not yet installed.

Hopefully, both Debian and Ubuntu have a package repository, http://packages.debian.org/ and http://packages.ubuntu.com.

Command line lover will love apt-file which will do the same job, but you won't have to use your web browser.

To install apt-file, simply run:

$ apt-get install apt-file

Then we need to update apt-file database with:

$ sudo apt-file update

After some times, once the Contents files are downloaded from the repositories, you will be able to query the database for myfile or path/to/myfile with the following commands:

$ apt-file search myfile

or

$ apt-file search path/to/myfile

Listing the content of an uninstalled package can be done with:

$ apt-file list mypackage

Finally, you can delete the cache files with:

$ sudo apt-file purge


source debuntu.org

check/identify bad sector in hard disk ?

what is the command/method/procedure to check/identify bad sector in hard disk ?

Jim

Boot up with the LiveCD and run fsck in a terminal:

Code: sudo fsck -a /dev/sdxx

Where /dev/sdxx is you hard drive and partition.

Thursday, November 6, 2008

10 (real) reasons to use ubuntu linux

Recently, a friend of mine asked me why I used linux. Being a linux user for more than 5 years, I have a lot of reasons on why to choose linux over windows, but nothing came to my mind at the time. I just knew I like it a lot better than windows. To settle things up, and have a more objective answer next time, I put some thought to it and came with this list.

In this post, I will evaluate all the reasons regarding the current distribution I use, which is Ubuntu. However, by no means I say that everyone should use linux. You may use it as long as it fits your needs, and i’m aware that many people cannot live without applications that were developed only for windows.

10. Package management system

In windows, one have to dig around the internet trying to find applications to install, and pray that they won’t come full of viruses. In linux, there is a wonderful thing called packages, and a neat little program called Synaptic where it is possible to just type whatever application you want and it will automatically download and install, all of that without any virus and 100% free.

9. Graphical interface

Yes, with vista, windows can now do a lot of stuff linux can. But one would have to install a ton of additional software. I got so addicted to the exposé, multiple desktops, and being able to make a window translucent that I miss these features a lot when I go back to windows. Also, the application menu of gnome is terrific when new installed applications automatically appear under the right category, making it easier to find the desired program.

The top bar is also a plus. Right now, I have a in-bar weather and CPU usage applet that come in handy. Although you can put them on the desktop on windows, I’m not sure you can put them on the bar without any external program.

8. Hardware Detection

This is one of the best features on linux, and can also be the worse. After installation is done, or wheter you plug in a new hardware, everything is detected and installed automatically. No hunt for drivers is needed. I just installed Ubuntu on a friend’s laptop and we didn’t need any extra configuration to get things working. Everything worked out of the box.

However, I have to admit that when something is not detected right away, it is a pain to set up properly. Most of the times, one would have to dig through several forums in order to figure out how to install a particular piece of hardware.

7. Process control

Linux is stable by nature, but sometimes things may go out of control. When that happens, a little tool called “xkill” comes in handy, by literally killing the trouble application instantly without messing up with system stability. Also, the “kill” command does the same thing for every process in the system. Unlike windows, you don’t have to wait for the process to shut itself down, and waste a lot of time. The process is killed instantly.

Another tool I miss in windows is the sysrq+s sysrq+u sysrq+b key combination. No matter where you are on linux, if you press that sequence, it will automatically unmount partitions and reboot the system. I have lost count on how many times I had to press the reset button on windows in order to get the machine rebooted because it wasn’t responding to any of my commands.

6. The terminal

Not many regular users would use it, but the terminal is a powerfull tool for power users. You can do anything you want with it, and most of the linux commands can be piped together to form more complex statements. I have lots of custom scripts that I use regularly to automate boring tasks such as renaming pictures, mounting encrypted filesystems, and even checking out code from a repository and deploy it automatically to a server.

5. Low system overhead

Vista needs at least 1GB of RAM in order to function properly. I used to run Ubuntu with full graphical interface with 512mb without a problem. The footprint of ubuntu over vista is considerably lower, giving more room to load more applications at one time. This is particularly useful when working with older hardware or thin clients.

4. System security

Vista introduced a series of annoying boxes that are prompted whenever you are about to make any system changes. I found that particularly annoying, and love the fact that linux only asks for the root password for very specific system settings.

Due to the open source nature of linux and its software community, security bugs are identified and fixed a lot quicker than in propietary software, making the system considerably more secure.

3. No viruses or trojan horses

The only real menace I know for linux are the rootkits, and even those need to exploit some bug. However, chances are that the particular bug in question was already fixed by security updates.

Although not really necessary if you aren’t running a server, a firewall is a plus in terms of increasing the security of your system. Nothing I know in windows can beat a well configured iptables, and few things can be more annoying than those security pop ups that appear in vista when some program wants to access the internet.

Finally, there is no need to waste your resources having an antivirus running all the time. Linux was built to be safe, so you can be sure that you won’t need any additional software constantly scanning for threats.

2. Fast release time

Thats particularly true with ubuntu: there is a new version comming around every 6 months with new and improved features. This beats by far the release cycle of windows, that can be as long as 2 or 3 years. Another good point is that your oppinion matters. If you find something wrong with your system, you can file a bug on lunchpad, and that will go directly to the developers of the system.

1. It’s free

This is a cliché, but it doesn’t mean it is not a good thing. I’m a cheap person, and I really like the fact that I can upgrade all my computers every six months to a state-of-art operational system without spending a penny out of my pocket.

Wednesday, November 5, 2008

/etc/bash.bashrc file ?

I was going through the book "Ubuntu Certified Professional Study Guide" by Michael Jang, the following were the points given in that book

function of /etc/bash.bashrc file ?

■ It assigns a prompt, which is what you see just before the cursor at the command prompt.

■ It includes settings from /etc/bash_completion to enable command completion.

■ It configures messages associated with sudo access; for more information

Is there any other poin t that the nauthor has missed ?


Erik hahn

* Set envrionment variablas, e.g. $EDITOR
* Start things like the gpg/ssh agent.
* Generally configure the shell (completion, history settings etc.)
* Setting aliases

Michael black

I't s a place to put things that you want when a bash shell is started up. That includes the things you mention, but by merely listing things you are overlooking the overall explanation that is most correct.

David H

/etc/bash.bashrc (also just .bashrc in some distros) is the basic system wide configuration file for interactive bash shells. Anything you put in it will be activated/run whenever a new bash console is opened. You can put things like aliases and shell functions in it, for example, or use it to set environment variables, or change whatever other bash settings you want.

And of course, like many similar *nix configuration files, there's also a corresponding ~/.bashrc in each user's home directory for customizing settings for each individual user.

/lib, /sbin directories

why is it said that /lib, /sbin directories should not be mounted on a separate partition ?


Laurenz Albe

Because they belong to the root file system.Without the files in these directories the system is unusable.These files should be there after / is mounted.

How, for example, do you want to start the init process, that eventually mounts the other file systems? The executable is /sbin/init.


Doug FreyBurger

Compiled binaries in a bin directory tend to reference compiled libraries in a lib directory. Most of the binaries in /sbin are statically linked but some can reference /lib. Since the first
filesystem mounted is root and the first binaries referenced are in /sbin they must be capable of running with no reference at all to any directory tree outside of /.

At install time there are options to move all sorts of directories to their own mount points. /opt and /usr don't have any issues like that. /sbin and /lib do have that issue.

The other directory that absolutely must be in the boot mount point is /etc because /etc/inittab lives there plus the scripts that do the mounts of all the other local file systems. Once
the rest of the local file systems are mounted it becomes less important where a executable binary is versus where its library binaries are.

Sunday, November 2, 2008

umount: /media/usbdisk: device is busy

if you try to unmount a partition and get a message
like this:


# umount /media/usbdisk/

umount: /media/usbdisk: device is busy



use the lsof command to find out what programs are using what files:

EX: lsof +D /media/usb

Find the process that’s opened the file from a specified directory. You can use this if you cannot unmount a USB drive and want to know which file is open.


# lsof /media/usbdisk/



This shows that the programs bash and xmms are using
the device. For an even clearer picture, use the device
name rather than the mountpoint:


# lsof /dev/sdb1




You either can wait until those processes exit or terminate them manually.



OR you can Force umount when the device is busy fuser -km /mnt/hda2