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. យកកំណែថ្មីបង្អស់របស់ បានស៊ី ពី។ ក្នុងសាច់រឿងនេះ កំណែចុងក្រោយគឺ ០.១១.២



  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។ អត្ថបទដើមជាភាសាអង់គ្លេសអាចរកឃើញនៅទីនេះ។ វីធីរៀបរាប់ខាងលើ បានផ្ទៀងផ្ទាត់ដោយខ្ញុំបាទ ជាមួយអូផេនស៊ូសា កំណែ១០.១។ បើមិត្តអ្នកអានមានចម្ងល់ ឬបានឃើញភាពខុសឈ្គងមួយណា សូមមេត្តាអោយខ្ញុំដឹងផង។ អរគុណ៕