Bash Command Shortcuts

How many times do you find yourself using arrow keys to scroll to the beginning or the end of line of the command line in bash terminal? Do you use backspace to delete every character of what you type to clear the command line? Well, if you answer “yes” to any of the two questions, continue reading.

I, myself, have been doing this a lot because I couldn’t remember the shortcut keys to do those tasks. So, I decided to write them here as a reference that could be referred to in the future. You can easily find the same or even thorough information on the web.

Useful Shortcut Keys
Key sequence What it does
Ctrl + U Delete to the end of line
Alt + D Delete to the end of current word
Alt + Backspace Delete to the start of current word
Ctrl + A Move to the start of line
Ctrl + E Move to the end of line
Ctrl + Left Arrow Move one word to the left
Ctrl + Left Arrow Move one word to the right

I hope those shortcuts could save you some time and the fingers from getting sore.


How to kill defunct process

Defunct processes are corrupted processes that can no longer communicate between the parent and child one. Sometimes, they become “zombies” and remain in your system until you reboot your machine. You can try to apply “kill -9” command, but most of the time you’ll be out of luck.

In order to kill theses defunct processes, you have two choices:
1. Reboot your computer
2. Continue reading…

First, let’s find out if the system contains defunct process:

$ ps -A | grep defunct

Assume your output is as the following:

8328 ? 00:00:00 mono <defunct>
8522 ? 00:00:01 mono <defunct>
13132 ? 00:00:00 mono <defunct>
25822 ? 00:00:00 ruby <defunct>
28383 ? 00:00:00 ruby <defunct>
18803 ? 00:00:00 ruby <defunct>

This means you have 6 defunct processes: 3 of mono, and 3 of ruby. These processes exists because of poorly written application or unusual action taken by the user, in my case there must be some serious problem with the program I wrote in mono C# πŸ™‚

Now, let’s find the ID of the process and its parent’s:

$ ps -ef | grep defunct | more

The output from the above command:


kenno 8328 6757 0 Mar22 ? 00:00:00 [mono] <defunct>
kenno 8522 6757 0 Mar22 ? 00:00:01 [mono] <defunct>
kenno 13132 6757 0 Mar23 ? 00:00:00 [mono] <defunct>
kenno 25822 25808 0 Mar27 ? 00:00:00 [ruby] <defunct>
kenno 28383 28366 0 Mar27 ? 00:00:00 [ruby] <defunct>
kenno 18803 18320 0 Apr02 ? 00:00:00 [ruby] <defunct>

UID: User ID
PID: Process ID
PPID: Parent Process ID

If you try to kill the process with ID 8328 with the command “kill -9 8328”, it may not work. To properly kill it, you need to execute the kill command on its parent whose ID is 6757 ($kill -9 6757). Continue applying the kill command on all the PPID, and verify your result ($ps -A | grep defunct).

If the previous command display no result, well done, otherwise you may need to reboot your system.


Airport Extreme and Fedora Core 6

Ever since Fedora Core 6 was installed on my PowerBook, I can only access the Internet via ethernet port. It is a not a big problem at home, however if I want to access my university’s network or the Internet from there, the Wireless access is the only way. There is almost no where on campus or in the lab that I could hook the ethernet cable in. So everytime I want to access the network there, I have to boot into Mac OS X.

Tonight, I decided to dig into Internet resources and very fortunately (almost as always), I found the working solution. This thanks to a guy named Anshul who posted this how-to on his blog when he installed Fedora Core 5.

In Fedora Core 6, the version of the default kernel is 2.6.18. The BCM4306 module is already a part of this kernel, therefore the Airport Extreme (which uses Broadcom BCM4306 chip) is automatically detected (this can be verified with this command: $ cat /proc/modules | grep bcm43
). However we still need to install its driver/firmware.

  1. # yum install bcm43xx-fwcutter
  2. Download the firmware: # wget
  3. # bcm43xx-fwcutter -w /lib/firmware wl_apsta.o
  4. # /sbin/modprobe bcm43xx
  5. # cp /usr/share/doc/bcm43xx-fwcutter-005/modprobe.bcm43xx /etc/modprobe.d/
  6. # system-config-network

Having completed the above steps, the Airport Extreme should be able to be activated and connected to the Wireless LAN with no encryption. My home wireless router use WPA as the encryption; I can’t afford to leave my Wireless router to be open due to security reasons. This brought a new issue to the Airport Extreme: it cannot connect to my network at all. Oh well, at least I can now connect to the university network.

As soon as I find the information regarding WPA setting on Linux, I’ll post it here. For those who is up for a challenge, you can search for this term “wpa_supplicant” in google. I’ll do that myself when ever time permits.

Enable Right-click & Middle-click with Fedora Core 6

The title should have been “How to enable right-click and middle click of PowerBook G4’s one-button-mouse in Fedora Core 6”. Since I’m not very keen in selecting a good title, I hope the one I wrote above made sense.

My Apple PowerBook G4 comes with just one button mouse. It’s not a problem when using it in OS X because I can simply emulate the right click by holding “fn” key while clicking. Recently, I just installed Fedora Core 6 as dual boot on this laptop; and one button mouse really gave me a big headache. I’ve beent trying to look for a good solution to fix this, but I didn’t get much luck. There were a few links on some blogs reporting that they had successfully solving this mouse problem by using something called “synaptic” driver, but that didn’t work for me either. The temporary solution was to use the USB mouse.

Today, I was very fortunate to have found this link that explained how to emulate the right-click as well as the middle-click. Here is a summary on how to do it:

  1. As a root, open up /etc/sysctrl.conf
  2. Add dev/mac_hid/mouse_button_emulation=1
  3. Save it and reboot the PowerBook

That’s all, now you can right click by pressing fn+Alt on the keyboard, and fn+Apple key will give you a middle-click.

Thanks to the author on that website, I no longer need to bring the USB mouse with me anymore.

αž…αž„αž€αŸ’αžšαž„ RPM αž–αžΈ Source RPMs

αž‡αžΆαž’αž˜αŸ’αž˜αžαžΆ αž–αŸαž›αžαŸ’αž‰αž»αŸ†αž”αž‰αŸ’αž…αžΌαž› αž€αž‰αŸ’αž…αž”αŸ‹αžαŸ’αž˜αžΈαŸ—αž€αŸ’αž“αž»αž„αž’αžΌαž•αž·αž“αžŸαŸŠαžΌαžŸαŸŠαžΈ αž”αžΎαžŸαž·αž“αž‡αžΆαž˜αž·αž“αž’αžΆαž…αžšαž€ binary rpm αž”αžΆαž“αž‘αŸ αžαŸ’αž‰αž»αŸ†αžαŸ‚αž„αžαŸ‚αž…αž„αž€αŸ’αžšαž„ (compile) αž€αž‰αŸ’αž…αž”αŸ‹αž‘αžΆαŸ†αž„αž“αŸ„αŸ‡αž–αžΈαž€αžΌαžŠαž”αŸ’αžšαž—αž–αžŠαžΎαž˜αŸ” αž€αžΌαžŠαž”αŸ’αžšαž—αž–αžŠαžΎαž˜ αž’αžΆαž…αžαŸ’αžšαžΌαžœαž”αžΆαž“αžαŸ’αž…αž”αŸ‹αž‡αžΆ tar.gz ឬ .src.rpmαŸ” αž€αŸ’αž“αž»αž„αž€αžšαžŽαžΈαž‘αžΈαž˜αž½αž™ αž™αžΎαž„αž‚αŸ’αžšαžΆαž“αŸ‹αžαŸ‚αž–αž“αŸ’αž›αžΆ αž€αžΌαžŠαž”αŸ’αžšαž—αž–αžŠαžΎαž˜ αžšαž½αž…αž”αž‰αŸ’αž‡αžΆ ./configure, make αž“αž·αž„ make install αž‡αžΆαž’αž˜αŸ’αž˜αžαžΆαŸ” αž–αŸαž›αž“αŸαŸ‡ αžαŸ’αž‰αž»αŸ†αžŸαžΌαž˜αž›αžΎαž€αž™αž€ αžœαž·αž’αžΈαž…αž„αž€αŸ’αžšαž„αž€αž˜αŸ’αž˜αžœαž·αž’αžΈ αž‡αžΆαž˜αž½αž™αž“αžΉαž„ αž€αžΌαžŠαž”αŸ’αžšαž—αž–αžŠαžΎαž˜ αžαŸ’αž…αž”αŸ‹αž‡αžΆ .src.rpmαŸ”

$ rpmbuild -clean -rebuild packagename.src.rpm

αž€αŸ’αžšαŸ„αž™αž–αžΈαž”αžΆαž“ αžœαžΆαž™αž–αžΆαž€αŸ’αž™αž”αž‰αŸ’αž‡αžΆαžαžΆαž„αž›αžΎαž αžΎαž™ αž€αž‰αŸ’αž…αž”αŸ‹ binary RPM αž“αžΉαž„αžαŸ’αžšαžΌαžœαž”αžΆαž“αž”αž„αŸ’αž€αžΎαžαž€αŸ’αž“αž»αž„ subdirectory αž“αŸƒ ថត /usr/src/packages/RPMS/αŸ” αžŸαžΌαž˜αž–αž·αž“αž·αžαŸ’αž™αž˜αžΎαž› αž€αŸ’αž“αž»αž„αžαžαžŠαŸ‚αž›αž˜αžΆαž“αžˆαŸ’αž˜αŸ„αŸ‡ αž…αžΆαž”αŸ‹αž•αŸ’αžαžΎαž˜αžŠαŸ„αž™αž’αž€αŸ’αžŸαžš i*** αž§αž‘αžΆαž αžšαžŽαŸ i386 αž‡αžΆαž€αžšαžŽαžΈαžšαž”αžŸαŸ‹αž˜αŸ‰αžΆαžŸαŸŠαžΈαž“αžαŸ’αž‰αž»αŸ†αŸ”

Enable Khmer Unicode support on Firefox

With fresh installation of SuSE Linux 10.1 or openSUSE 10.2, Firefox does not display Khmer Unicode font properly. However, there is a very easy fix, all you have to do is to add the “MOZ_ENABLE_PANGO=1” to your .profile.

  1. Go to your home directory, then edit the .profile file. I use vi (vi .profile)
  2. Scroll down to the last line of the file and add: export MOZ_ENABLE_PANGO=1
  3. Save the .profile file, in my case I do (ESC, SHIFT+Z+Z). Restart the Firefox.

Voilla! It’s done and the Firefox should display Khmer Unicode font nicely and correctly now.

αžŸαŸ’αžαžΆαž”αž“αžΆ αž“αž·αž„ αžŠαŸ†αž‘αžΎαž„ αž”αžΆαž“αžŸαŸŠαžΈ αž›αžΎβ€‹ αžŸαŸŠαžΌαžŸαžΆαž›αžΈαžŽαžΆαž€αŸ‹ αŸ‘០.៑

αžŠαŸ„αž™ Magnus Hoglund

  1. αž”αŸ’αžšαžŸαž·αž“αž”αžΎαž›αŸ„αž€αž’αŸ’αž“αž€αž”αžΆαž“αžŠαŸ†αž‘αžΎαž„ αž€αŸ†αžŽαŸ‚αž…αžΆαžŸαŸ‹αžšαž”αžŸαŸ‹αž”αžΆαž“αžŸαŸŠαžΈ αžŸαžΌαž˜αž…αžΆαž”αŸ‹αž•αŸ’αžαžΎαž˜αžŠαŸ„αž™αž›αž»αž”αžœαžΆαž‡αžΆαž˜αž»αž“αžŸαž·αž“αŸ”
  2. αžŠαŸ†αž‘αžΎαž„αž€αž‰αŸ’αž…αž”αŸ‹αž‘αžΆαŸ†αž„αž“αŸαŸ‡ (αžŠαŸ„αž™αž”αŸ’αžšαžΎ Yast)αŸ–
    • mono-develop
    • monodoc-core
    • sqlite-devel
    • libmusicbrainz-devel
    • gstreamer010-devel
    • libgnomeui-devel
    • gnome-desktop-devel
    • nautilus-cd-burner-devel
  3. αž™αž€αž€αŸ†αžŽαŸ‚αžαŸ’αž˜αžΈαž”αž„αŸ’αž’αžŸαŸ‹αžšαž”αžŸαŸ‹ αž”αžΆαž“αžŸαŸŠαžΈ αž–αžΈ http://banshee-project.orgαŸ” αž€αŸ’αž“αž»αž„αžŸαžΆαž…αŸ‹αžšαžΏαž„αž“αŸαŸ‡ αž€αŸ†αžŽαŸ‚αž…αž»αž„αž€αŸ’αžšαŸ„αž™αž‚αžΊ ០.៑៑.្



  4. αžŸαŸ’αžšαžΆαž™ αž”αžΆαž“αžŸαŸŠαžΈ (banshee-0.11.2.tar.gz) αž‘αŸ…αžαžαž”αžŽαŸ’αžαŸ„αŸ‡αž’αžΆαžŸαž“αŸ’αž“αž˜αž½αž™αŸ”

    tar xzvf banshee-0.11.2.tar.gz

  5. αž”αžΎαž€αžŸαŸ’αžαžΆαž“αžΈαž™αŸαž˜αž½αž™ αž€αŸ’αž“αž»αž„αžαžαž“αŸαŸ‡ αž αžΎαž™αžšαžαŸ‹αŸ–


  6. αž”αŸ’αžαžΌαžšαž‘αŸ…αž‡αžΆαž«αžŸ (su) αžšαž½αž…αžšαžαŸ‹αŸ– make install
  7. αž…αŸαž‰αž‘αŸ…αž‡αžΆαž’αŸ’αž“αž€αž”αŸ’αžšαžΎαž’αž˜αŸ’αž˜αžαžΆ αž“αž·αž„ αž…αžΆαž”αŸ‹αž•αŸ’αžαžΎαž˜ αž”αžΆαž“αžŸαŸŠαžΈ (/usr/local/bin/banshee &)
  8. αž€αžΆαžšαžŠαŸ†αž‘αžΎαž„ plugins αžšαž”αžŸαŸ‹ αž”αžΆαž“αžŸαŸŠαžΈ αž’αžΆαž…αž’αŸ’αžœαžΎαž”αžΆαž“αžŠαŸ„αž™αžœαž·αž’αžΈαžŠαžΌαž…αž‚αŸ’αž“αžΆαŸ” αž€αŸ’αž“αž»αž„αž€αžšαžŽαžΈαžšαž”αžŸαŸ‹αžαŸ’αž‰αž»αŸ† αŸ—αž”αžΆαž“αžŸαŸ’αžšαžΆαž™ banshee-offical-plugins-0.11.2.tar.gz αž“αž·αž„αžšαžαŸ‹ αž–αžΆαž€αŸ’αž™αž”αž‰αŸ’αž‡αžΆαžŠαžΌαž…αžαžΆαž„αž›αžΎ (αž˜αžΆαž“αž“αŸαž™αžαžΆαŸ– “./configure” “make” “make install”)

αž“αŸαŸ‡αž‡αžΆαž€αžΆαžšαžŸαŸ’αžšαŸαž… αžŸαžΌαž˜αžšαžΈαž€αžšαžΆαž™αžŸαž”αŸ’αž”αžΆαž™αž‡αžΆαž˜αž½αž™αž”αžΆαž“αžŸαŸŠαžΈ!

Banshee 0.11.2 Screenshot

αž’αžαŸ’αžαž”αž‘αžαžΆαž„αž›αžΎαž”αžΆαž“αž”αž€αž”αŸ’αžšαŸ‚αž–αžΈ Novel Cool SolutionαŸ” αž’αžαŸ’αžαž”αž‘αžŠαžΎαž˜αž‡αžΆαž—αžΆαžŸαžΆαž’αž„αŸ‹αž‚αŸ’αž›αŸαžŸαž’αžΆαž…αžšαž€αžƒαžΎαž‰αž“αŸ…αž‘αžΈαž“αŸαŸ‡αŸ” αžœαžΈαž’αžΈαžšαŸ€αž”αžšαžΆαž”αŸ‹αžαžΆαž„αž›αžΎ αž”αžΆαž“αž•αŸ’αž‘αŸ€αž„αž•αŸ’αž‘αžΆαžαŸ‹αžŠαŸ„αž™αžαŸ’αž‰αž»αŸ†αž”αžΆαž‘ αž‡αžΆαž˜αž½αž™αž’αžΌαž•αŸαž“αžŸαŸŠαžΌαžŸαžΆ αž€αŸ†αžŽαŸ‚αŸ‘αŸ .αŸ‘αŸ” αž”αžΎαž˜αž·αžαŸ’αžαž’αŸ’αž“αž€αž’αžΆαž“αž˜αžΆαž“αž…αž˜αŸ’αž„αž›αŸ‹ αž¬αž”αžΆαž“αžƒαžΎαž‰αž—αžΆαž–αžαž»αžŸαžˆαŸ’αž‚αž„αž˜αž½αž™αžŽαžΆ αžŸαžΌαž˜αž˜αŸαžαŸ’αžαžΆαž’αŸ„αž™αžαŸ’αž‰αž»αŸ†αžŠαžΉαž„αž•αž„αŸ” αž’αžšαž‚αž»αžŽαŸ•