Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, February 6, 2017

How to Recursively Delete Files from a Folder

Let say you want to delete all files of type ".bak" recursively from a folder.

Step 1: List all the files of ".bak" in the folder to check whether you will delete the correct files.
  1. Open up Terminal
  2. In the command line, type:
  3. Drag and drop the folder you wish to delete ".bak" files from.
  4. Press enter.
  5. In the command line, type:
    find . -name '*.bak' -type f
  6. Press enter.

If you are confirmed that you want to delete the listed files, proceed to Step 2.

Step 2: Delete all the "*.bak" files.
  1. In the command line, type:
    find . -name '*.bak' -type f -delete
  2. Press enter.

Please be careful.

Friday, July 24, 2015

Remove everything from the terminal prompt except for the current directory

You can remove everything from the terminal prompt except for the current directory if you append the following code into ~/.bash_profile.
export PS1="\W\$ "

Wednesday, April 22, 2015

wget: Download files with certain extension only

To download only files of type pdf from,
wget -r --no-parent --accept "*.pdf" --level 2

Thursday, March 13, 2014

Ubuntu: How to enable spellchecker in LyX

  1. Open the Terminal and install Enchant.
    sudo apt-get install enchant
  2. Open LyX and select Tools > Preferences > Language Settings > Spellchecker
  3. Select Enchant for Spellchecker Engine.
  4. Click on Apply, Save and finally Close.

Wednesday, March 12, 2014

Ubuntu: Missing Date and Time (Clock) in the Indicator Bar

sudo apt-get install indicator-datetime
sudo dpkg-reconfigure --frontend noninteractive tzdata
killall unity-panel-service

Thursday, February 13, 2014

GIMP: Missing toolbar

In order to restore the missing toolbar for GIMP, locate and delete the "sessionrc" file in GIMP profile.

Where is the GIMP profile?

  • Windows XP: C:\Documents and Settings\your_username\.gimp-2.8
  • Vista and Windows 7: C:\Users\your_username\.gimp-2.8
  • Linux: /home/your_username/.gimp-2.8/

Sunday, April 7, 2013

My First OpenCV Sample Program

This is my first OpenCV code that was compiled and run on my Ubuntu 13.04 machine.

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main() {
    // read an image
    cv::Mat image = cv::imread("my_photo.jpg");
    // create image window named "My Image"
    cv::namedWindow("My Photo");
    // show the image on window
    cv::imshow("My Photo", image);
    // wait key for 5000 ms
    return 1;
g++ -o hello hello.cpp `pkg-config opencv --cflags --libs`

Sunday, October 30, 2011

How to make Firefox to Open Popup as a New Tab

The following procedure will make Firefox to open popup as a new tab.

  1. Launch Firefox, type

    into the location bar, and hit the Enter key.

  2. Click the "I'll be careful, I promise!" button.

  3. Type

    into the filter bar.

  4. Right click on the result, choose "Modify". Change the integer value to 0. The default is 2. Click OK.

  5. Finally, restart Firefox.

Now, all popup will open as a new tab.

Saturday, September 17, 2011

How to clear the DNS cache for Windows, Mac and Linux

Command for clearing the DNS cache for Windows, Mac and Linux.

The commands need to be run at the command prompt with administrator privileges.


ipconfig /flushdns

Mac OSX 10.4 (Tiger)

lookupd -flushcache

Mac OSX 10.5/10.6 (Leopard/Snow Leopard)

dscacheutil -flushcache

Linux (Most Distributions)

sudo /etc/init.d/nscd restart
sudo /etc/init.d/networking restart

Saturday, January 15, 2011

How to run Java class file on Ubuntu

Let say you compile the following Java codes
public class hello {
    public static void main(String[] args) {
using the following command:
You will get a class file `hello.class`.

However, when you try to run the Java class file using
java hello

like you usually did on Windows, it won't run.
Exception in thread "main" java.lang.NoClassDefFoundError: hello Caused by: java.lang.ClassNotFoundException: hello at$ at Method) at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( Could not find the main class: hello. Program will exit.
Actually, to run Java class file on Ubuntu, you need to always specify the classpath, using the `-cp` options.

As an example,
java -cp . hello

The `.` means the current working directory. In other words, you are telling Java to look for `hello class` in the same directory that you invoke the `java` command.

You can also add the current directory to the CLASSPATH, like this:
If you don't like to do that each time you want to run a Java class file, you can set the CLASSPATH permanently in /etc/environment or in ~/.profile.

Wednesday, February 3, 2010

How to configure Pidgin for Google Talk

Pidgin is an easy to use and free chat client that can connect to many chat networks all at once. The supported chat networks are AIM, Bonjour, Gadu-Gadu, Google Talk, Groupwise, ICQ, IRC, MSN, MySpaceIM, QQ, SILC, SIMPLE, Sametime, XMPP, Yahoo! and Zephyr.

But, sometimes Pidgin just don't work with Google Talk. You need to tweak Pidgin in order to make it works.

Here are the steps (as shown in Figure 1):
  1. Click on Account > Manage Accounts, add new Google Talk account. Fill in the Username and Password.
  2. Click to the Advance tab.
  3. Make sure that "Require SSL/TLS" and "Force old (port 5223) SSL are selected.
  4. Type 443 for "Connect port".
  5. Type "" for "Connect Server".
  6. Click on the "Save" button.
Pidgin should now works with Google Talk. By the way, I also figured out that sometimes I need to remove these settings, in order to connect to Google Talk, when I move to different place.

Saturday, January 23, 2010

Replace y with 3 to download YouTube Video provides an easy way to download YouTube videos to your PC. The video could be downloaded in MP4 or FLV formats. The service is provided for free.

Figure 1: Replace letter "y" with number "3"
In order to download the video, replace the letter “y” with number “3” of the YouTube video link that you want to download as shown in Figure 1. Finally, choose the format of the video to download (Figure 2).

You can also go to their website and enter the YouTube video link directly inside a text box at the bottom of the page.

Figure 2: Choose between .MP4 or .FLV video format. 
I know there are other similar service exist, but replacing letter “y” with the number “3” to download the video is such an awesome idea.

Friday, January 22, 2010

How to create word cloud for free

Word cloud also known as tag cloud is a generated tags based on the words of a web site. In other words, we can say that it is a visual picture of a web site.

Wordle is a free web application to create word cloud. It has the capability to create word cloud from a bunch of pasted text, from a blog or web site with Atom or RSS feed enabled, and from user tags.
Word cloud created with Wordle
According to Wordle, word cloud created with Wordle can be used for anything, even if you are making profit of it, as long as the credit goes back to Images created by the web application are licensed under a Creative Commons Attribution 3.0 United States License. Examples of usage include book cover, t-shirt or even as blog header like the one used by WordPress Foundation blog, which was made public today. Read WordPress Foundation first article.

What is your opinion about word cloud? Is it a good way to describe your blog? Please leave your comment.

Firefox 3.6 keyboard shortcuts

Mozilla Firefox 3.6 (codename Namoroka) was released yesterday. Mozilla claims that Firefox 3.6, which was built on Mozilla's Gecko 1.9.2 web rendering platform, is faster and more responsive than the previous version.

Table 1 listed the Firefox keyboard shortcuts that will help you use Firefox expeditiously.

Table 1: List of Firefox keyboard shortcuts.
Keyboard shortcutFunction
ctrl + TOpen a new empty tab
ctrl + WClose a tab
ctrl + shift + TReopen a closed tab
ctrl + +Zoom in
ctrl + -Zoom out
ctrl + 0Zoom reset
ctrl + LMove cursor to the location bar
ctrl + KMove cursor to the search box
space barScroll down the page
shift + space barScroll up the page
ctrl + RRefresh the page
alt + left arrowBack
alt + right arrowForward
ctrl + 1Switch to the first tab
ctrl + 2Switch to the second tab
ctrl + 3Switch to the third tab
ctrl + 4Switch to the forth tab
ctrl + 5Switch to the fifth tab
ctrl + 6Switch to the sixth tab
ctrl + 7Switch to the seventh tab
ctrl + 8Switch to the eight tab
ctrl + 9Switch to the last tab

As an addition, the mouse middle button is also useful. Click the middle mouse button on a tab will close it. Click the middle mouse button on a link will open the link in a new window.

You can also make the middle mouse button to paste copied text, as in Linux. However, you need to tweak Firefox a bit.

This are the steps to enable the middle mouse button as a paste command.

  1. Move the cursor to the location bar by using your mouse or ctrl + L shortcut key.

  2. Type about:config in the location bar and press Enter.

  3. Click on “I’ll be careful, I promise!”.

  4. Type middlemouse in the Filter bar. A list of commands will appear.

  5. Double click command middlemouse.paste. Note that it’s value will now turns to True.

I have listed some useful Firefox keyboard shortcuts that help me browse the Web efficiently. If you know other keyboard shortcuts that I have missed, please leave a comment.

Thursday, November 19, 2009

3 free online resources to help you learn Linux commands

These websites should provide you with the basic (up to advance) command line skills, as well as teach you some neat command line tricks.

1. is a Linux education and advocacy site devoted to helping users of Linux operating systems.


2. Linux Command Directory

Linux Command Directory is a directory of 687 Linux commands with descriptions.

Visit Linux Command Directory.

3. The Linux Cookbook

The Linux Cookbook presents "recipes" for preparing or accomplishing a particular, specific thing.

Visit The Linux Cookbook.

Thursday, November 5, 2009

Ubuntu: Restore panels to default settings

How to restore panels on Ubuntu?

Step 1:

Delete current panel settings.
rm -rf ~/.gconf/apps/panel

Step 2:

Restart the Gnome panel.
pkill gnome-panel
As an alternative, just restart the computer.

Monday, October 26, 2009

Change file format (Dos/Unix) in Vim

Unix and dos (Windows) use different file format. Even though the latest Vim can detect the file format automatically, sometimes you also need to convert your file to the other format, especially if you are sharing the file with your friends.

Fortunately, in vim you can set the file format using a very simple command.

Change the file format to dos

:set ff=dos

Change the file format to unix

:set ff=unix


You can also add those commands in .vimrc file to make Vim starts with the desired format of file.

Prayer times software for Ubuntu

Minbar Prayer Times is a free prayer times software for linux.

Installing Minbar on Ubuntu is easy.
$ sudo apt-get install minbar
After the installation process, you can start Minbar Prayer Times from the Accessories menu.

Minbar Prayer Times
To set the location, click on Preferences, and under the City Details tab, click on "Find City". You should find your city there. If your city is not available, you can find the latitude and longitude via, and enter it manually.

If you can suggest other free prayer times software for Ubuntu, please leave a comment.

Monday, October 12, 2009

How to install GIMP for Linux

These are the commands to install GIMP on various Linux flavour from the distribution package.


apt-get install gimp


yast -i gimp


yum install gimp


urpmi gimp