Sunday, 11 March 2012

Determine Directory Size From Terminal In Linux [How To]

Sometimes you are working on command line and you want to find the total size of any directory. An instance is while working over SSh. Here is a technique on how you can determine the size of any directory from terminal.

du command lets us estimate the file space usage and can be recursively used for directories as well. This command can also be useful if you want to find the folder sizes of each subdirectories in any specified directory, something that would have been hard to achieve from the GUI.

To find the total size of a directory, use the -sch switch as below:

samar@Techgaun:~/Desktop/samar$ du -sch directory_name

The screenshot below will help you understand more clearly:


If you would like to see some more details like the size of each subdirectory, use the -hc switch as below:

samar@Techgaun:~/Desktop/samar$ du -hc directory_name

Check the screenshot below:


The du command provides more advanced stuffs such as exclusions of files and directories and depths for determining size. I hope this helps you. :)


Read more...

Finding Prime Factors Of A Number From Linux Terminal

Linux is awesome because of its powerful commanline interface from where you can do any tasks of varied complexities. I've been posting different command line tricks for system administrations & stuffs like that. But this time I am posting a little command line trick to find the prime factors of any number.


Linux provides a command factor that lets you find the prime factors of any number. So if you are into mathematics and working on prime factorizations, why worry? Just open the terminal and use the factor command.

This command takes any number of integer values as the argument and prints the prime factor of each of them. If no number is specified, it takes the value from standard input.

samar@Techgaun:~$ factor 2056 1234567

More information on factor command: The factor command makes use of the Pollard Rho algorithm which is suitable for numbers with relatively small factors. It is not quite good for computing factors of large numbers whose factors are not small values.


Read more...

Friday, 9 March 2012

Being Away and Back In All IRC Chans At Once [XChat Tip]

Hi everybody, one friend of mine asked me today if he could mark himself as away at once in all the open servers and he was using the XChat IRC client in mint and I quickly remembered the allserv and allchanl commands. So here I am sharing the quick tip on how you can mark yourself away in all the open IRC channels at once in XChat IRC client.


XChat provides two commands allserv and allchanl that can be used to run any specified command for all the open IRC servers and IRC channels of currently selected server respectively. The syntax is very simple as below:

/allserv <cmd>

The first command i.e. allserv allows to run any IRC command in all servers you have open currently. So if you want to mark yourself away, all you have to use is away command in conjunction with allserv command(fyi, away syntax is /away Reason for being away), type the command as below:

/allserv away Brb Breakfast time

Once you come back and do not need to be marked as away in all servers, enter the command as below:

/allserv back

The above allserv example is for marking you as away for all the servers. What if you want to mark yourself as away in all the channels of currently selected server? Don't worry, xchat offers allchanl for this very purpose. See the examples below using this command.

Set yourself away:

/allchanl away Brb Breakfast time

Set yourself no longer away:

/allchanl back

I hope these information help you. :)


Read more...

Monday, 5 March 2012

NTC Now Offering Bill Payments From MPoS & Pre-paid Recharge Cards

The leading telecommunication company Nepal Doorsanchar Company Limited commonly known as Nepal Telecom is now offering its customer the ability to pay the bills for post-paid, land-line telephone and ADSL services by using its pre-paid recharge card or MPoS. Now the nepal telecom users can make use of MPoS(Mobile Point of Solution) system to clear their bills. Thus there will be no more need of waiting for your turn in the telecom counters and no need to face the sluggish and irritating telecom workers :D(happened to me in Banepa) for clearing the bills for these common telecom services.


Nepal telecom allows its customers to use both namaste pre-paid recharge card and MPoS technology to pay the bills of GSM post-paid, PSTN(landline) and ADSL services. With these methods, you can pay from Rs. 100 to at most Rs. 1000 at once as per your necessity.

Follow one of the below stated methods to pay your bills:

From IVR(Interactive Voice Response): Dial 1413 and follow the instructions for bill payments.

From USSD i.e. pre-paid recharge card: Buy the amount of recharge chard of your choice/necessity and dial *411*Pin No.*10# from your GSM post-paid mobile.

From MPoS Technology: Go to your Nearest MPoS retailer and get the payment done by providing your GSM post-paid mobile number, PSTN number or corresponding ADSL number. For the list of MPoS retailer, visit this link.

Also, you can verify your payments and it is recommended you check the payment status before and after doing the payment. Following are the procedures for verifying your payment:

GSM post-paid: Send new message to 1400 by typing cb.
PSTN: Dial 1606 and get your payment information from IVR.
ADSL (Unlimited and Volume Based Service): You can view your payment details by going to www.ntc.net.np/internet/adsl. Open the above URL to access online Customer Care Interface and login to the system with your login details.

I hope this post counts useful for you. :)


Read more...

Wednesday, 29 February 2012

Some Funny IRC Chat Logs Ever

This summary is not available. Please click here to view the post.
Read more...

Tuesday, 28 February 2012

Reloading The Page Using Javascript

If you wish to put a nice little Reload this page link in your page, the javascript provides a reload() method that you can use for reloading the page.

The reload() method in window.location can be used to reload the page and works well in most of the browsers. An example snippet is shown below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
 <title>Reload example</title>
 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
 <meta name="generator" content="Geany 0.20" />
</head>

<body>
 <iframe height="300" width="300" src="http://wwwindow.location.reload(true)w.google.com"></iframe>
 <a href="javascript:window.location.reload(true);">Reload this page</a>.
</body>

</html>

I hope this comes useful sometimes.


Read more...

List of Hashing Algorithms Used In Major CMS & Forums

Just found this random image from one digital friend and its a pretty good list of hashing algorithms used in many web based applications such as CMS and forum softwares. Some of these algorithms might get outdated with newer versions, but still it will be a good reference.

list of hash algorithms for major web apps

View Full Size Image

Note for creator: If you are the owner of this image, please let me know so that I can give you the credit.


Read more...

Tuesday, 21 February 2012

Remove EXIF Data From Pictures Using Linux Terminal [How To]

Exchangeable image file format (Exif) is a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras.



Taken from wikipedia, above information says basically what the EXIF data is. Such EXIF data are usually found in JPEG and TIFF images and much deeper information is given by wikipedia. Now that you understand what EXIF data is, we will now see how we can remove EXIF data.

We like to remove the EXIF data to hide what the picture was build or taken with. For example, a photographer would like to remove the EXIF data after doing some photoshop stuffs on the image so that high-tech people would not find any EXIF presence of photoshop. (This is just an example).

The tool we will be using to remove EXIF data is not other than a part of ImageMagick package, mogrify. So we will use the mogrify command to remove or strip out the EXIF data from the image and then we will see how we can strip EXIF data from multiple files at once.

To strip EXIF from an image, type the following command:

mogrify -strip IMAGE_NAME.JPG

Now, to strip EXIF from folder containing several images, type the following command:

find ~/Desktop/test/ -name '*.jpg' | xargs mogrify -strip

Or use the for loop as below:

for i in ~/Desktop/test/*.JPG; do mogrify -strip $i; done


I hope this helps you. :)


Read more...