Pages

Wednesday, 24 December 2014

Add Exchange account to Gmail 5.0 on older android versions

I installed unofficial CM 12 with Android 5.0.2 today. Earlier I was using stock Android Lollipop and it had the option of adding Microsoft Exchange account. Unfortunately CM12 didn't seem to have it.

After doing some research I figured out that only devices running stock Android 5.0+ are capable of having exchange accounts. And CM12 although runs on Android 5.0, doesn't have this feature. On doing further research I found out that Android 5.0+ have something called Exchange services which enables gmail 5.0 to handle exchange accounts.

Download Exchange Services


Then, install and restart your device. Walah! Gmail will be able to add exchange accounts!

Note: This method is not just for CM

Friday, 5 December 2014

How I fixed bootloop on my Nexus without loosing data

I was playing around with framework-res.apk and SystemUI.apk to get Ambient Display on my Nexus 4. When I restarted my phone, it seemed to have stuck in a bootloop. I knew that factory reset might've worked. But I didn't want to lose any data.

Fortunately adb was working. When I did adb logcat , it was logging an error saying:
 /system/framework/framework-res.apk is neither a file nor a folder (type=0)

I realized that there was some problem with permissions of that file. I used adb shell and changed the permission of framework-res.apk and SystemUI.apk to 0644. But this was of no use. However I came to know that if I could somehow reset /system partition the problem would be solved.


  • So I downloaded the factory image of my phone. For nexus devices it is available here
  • Extract the contents of the image-xxxx-xxxx.zip to get the file system.img.
  • Then ran the following:
    adb reboot bootloader
    fastboot flash system system.img
  • This will wipe the /system partition and reset it without touching any other partitions. Hence you will not lose any data.
  • Restart. It took a while to start the phone completely. But it solved the problem!
This is how I was able to reset my framework-res.apk and SystemUI.apk!


Monday, 24 November 2014

Type checking in javascript has never been easier

I love languages which aren't strongly typed. It makes software development process very fast and very easy as we need not write huge, complex, unreadable code like in our typed languages. However this can lead to developer's worst nightmare: Runtime errors! In languages such as javascript it is not easy to check for type mismatches while in development process. Hence flow was invented!

Flow is one of Facebook's open source projects. It allows developers to check for programming errors in javascript code with very less effort. This is a sample code available on their site:

function foo(x) {
  return x * 10;
}
foo('Hello, world!');

Note that a string is passed into the function foo and an arithmetic operation is performed on that string inside it. When flow is run on this code:

01_HelloWorld/hello.js:7:5,17: string
This type is incompatible with
  01_HelloWorld/hello.js:4:10,13: number

It points out that the string is incompatible with number. Consider a much much complex code. An error like this can simply be unnoticed until a runtime error is raised.

Source: https://github.com/facebook/flow
Installation: http://flowtype.org/docs/getting-started.html
Examples: http://flowtype.org/docs/five-simple-examples.html

Sunday, 23 November 2014

Navigation Bar suddenly disappeared on Nexus

This can happen on any phone with soft navigation keys.

Yesterday, I was tweaking my Nexus 4 after updating to Lollipop. When I restarted my phone I found that the Navigation Bar had disappeared! Even to switch from one app to another I had to restart my phone! Then I found a way to fix it.

Install Root explorer or ES Explorer. Open it and go to /system and mount it in R/W.

Then open the file build.prop in the current folder using text editor.

Then go to bottom of the file and change the value of "qemu.hw.mainkeys" from 1 to 0
Reboot and you are done!


Thursday, 30 October 2014

How to mount NTFS External Disk in write mode in OS X Yosemite

This works for Mavericks also :)

It is not possible by default to mount a NTFS External Drive in write mode on OS X since Mavericks. There is a complex way to do this. In order to make it simple for you, I wrote a script which does it.

First you need to install Xcode and Homebrew. Google how to install them :P

Download this script


Then do this:
chmod +x ntfs_write_mode_enabler
./ntfs_write_mode_enabler

Now connect the driveIn Mavericks you will get a warning “Kernel extension is not from an identified developer”. You are good to go if you click OK. However, if you are using Yosemite, you have to restart your system to load the kernel extension. For more on that read this.

In Yosemite you might get the following error if you are updating old osxfuse. As we have enabled developer mode which allows you to run unsigned kext, it will not be a problem.

osxfuse: OS X Mavericks or older is required for this package.

OS X Yosemite introduced a strict unsigned kext ban which breaks this package.You should remove this package from your system and attempt to find upstream binaries to use instead.

Uninstalling


Execute the following command to replace the modified NTFS mounter with the original one

sudo mv /sbin/mount_ntfs.old /sbin/mount_ntfs

Loading unsigned kernel extensions on Yosemite

Since Mavericks, OS X started checking signatures of kernel extensions. However unlike in Mavericks, loading unsigned code to kernel is disabled in Yosemite (in Mavericks only a warning, “Kernel extension is not from an identified developer” was displayed). It is required to sign kernel extensions using the Developer ID obtained after enrolling in Mac Developer program. With Yosemite still in beta, it is hard to find signed kernel extensions other than the ones officially released by Apple. 

You will get this error when you try to load unsigned kext:

Diagnostics for [unsigned kext]:
Code Signing Failure: not code signed
ERROR: invalid signature for [unsigned kext], will not load

This being said, it is possible to sign all unsigned kext by doing this:

sudo nvram boot-args="kext-dev-mode=1"
Restart to get all the kext running!

Wednesday, 29 October 2014

Porting from Eclipse to Android Studio on mac

First download android studio from here.

Install Android studio from the .dmg file as usual

Now, before opening Android studio, open the terminal and delete the sdk which comes with it.

cd /Applications/Android\ Studio.app
rm -rf sdk

Now create a link of your old sdk in that folder

ln -s [absolute path to old sdk]  /Applications/Android\ Studio.app/sdk

Now open Android studio like any other app and open your existing project. You are good to go!


Or follow this to migrate your eclipse project to gradle!

Monday, 6 October 2014

How to fix blurry windows on retina display on mac

You might've observed that some third party apps have blurry windows on mac. This is due to the fact that those apps are not making use of the retina display introduced by Apple sometime back. I found a simple way to fix this using an app called Retinizer. Simply drag and drop the app (.app file from Applications folder) to its window to "Retinize" the app!

DOWNLOAD: http://retinizer.mikelpr.com/


Sunday, 5 October 2014

The curious case of deleting .nomedia file

Deleting .nomedia file not enough to make a folder visible in android gallery

TL;DR: After removing .nomedia file, add/delete some file in that folder.

You might probably know that if you want to hide a folder from gallery all you have to do is create an empty file called .nomedia. This will make sure that the media scanner will skip that folder.

Sometime back I did this when I wanted to hide the Whatsapp folder from gallery. Now I changed my mind and want Whatsapp folder to show up in the gallery. So I did like any other guy would do -- I deleted .nomedia file from that folder. But this didn't work.

If I had any android version prior to Kitkat, I could've just run media scanner from some app. Unfortunately after Kitkat this wouldn't work (They changed how media scanner works to save battery).

Then I tried renaming the folder (after deleting .nomedia file). Magically, all the images started displaying in the gallery. However, I couldn't afford changing the name of the folder.

I realized that post jellybean, media scanner updates the media index only when there is a change in the folder. So, I just added a new image to that folder manually. It worked like a charm!

NOTE: If the folder is on sdcard, you can just remove the sdcard and put it back (after removing .nomedia file) to run media scanner.

Tuesday, 30 September 2014

How to open apps from terminal on mac

I switched to mac from ubuntu recently. I noticed that apps installed from .dmg files are not accessible from terminal. In ubuntu to open say, gvim (MacVim in mac) I used to simply type gvim in the terminal. This doesn't work on mac :(

After doing some analysis on how apps are maintained, I noticed that each application (.app) is stored in /Applications folder. And .app file is simply a directory holding contents of the app. Say I open firefox, the executable which launches the app (firefox), stored in /Applications/Firefox.app/Contents/MacOS is executed.

So if I execute:
/Applications/Firefox.app/Contents/MacOS/firefox
from terminal, firefox is launched!

However I do not want to type this huge path every time I want to launch firefox nor do I want to alias each and every app I install nor do I want to add all of them to $PATH. So I wrote a simple script to automatically open any app I want to.

Step1


Download this gist

Step2


Make it executable and move it to /usr/bin. You are done!

$ chmod +x app

$ sudo mv app /usr/bin/


How to use it?


Say you want to open chrome from terminal to open a html file

$ app chrome index.html

Say you want to launch vlc from terminal to open a file

$ app vlc file.mp4

Say you want to open MacVim from terminal and open a file. Note that it is case insensitive.

$ app macvim file

Thursday, 25 September 2014

ShellShock: Largest security bug ever in the computing world

​'Bigger than Heartbleed': Bash bug could leave IT systems in shellshock
- CNET

Shell Shock: Bash bug labelled largest ever to hit the internet
- Sydney herald

You might have heard about "ShellShock" bug in bash shell that everyone is talking about. You might ask what is the big deal about it? and say that you don't even use bash. It might astound you if I say that this bug exists in so many systems from your fancy smart watches to android phones to Macbooks to powerful web/email/DHCP servers. Basically, bash shell is used everywhere!
"Heatbleed" bug, a vulnerability in OpenSSL servers, created a huge fuss few months back. Experts think that ShellShock is much more serious than that considering the number of systems being affected. Lot of military and government organizations are at risk.


So what is Shell Shock?

It is a vulnerability present in bash till 4.3. Because of this lot of applications using bash are not safe. This 22 yr old bug exists because of the way bash handles environment variables. It is common to assign a function to an environment variable in shell scripts. However it was noticed that the trailing code in the function definition is also executed. Hence it is possible to remotely execute malicious code in many websites by just injecting it at the end of function definition.

To give more detail consider:

env X="() { pwd; ls;}; echo hacked" bash -c "echo done"

The result is:
hacked
done

After function definition, malicious code echo hacked was also executed!

Am I safe?

Open terminal and execute this:

env X="() { pwd; ls;}; echo hacked" bash -c "echo done"

You have to worry if the result is:
hacked
done

instead of
done

In action!

There are three files in the folder:
DO_NOT_DELETE_THIS.txt
IMPORTANT.txt
I_WILL_GET_FIRED_IF_I_LOSE_THIS_FILE.txt

after executing this all files get deleted!:

env X="() { :;}; rm -rf *" bash -c "echo completed"

Note that rm -rf * is injected (Here I have just typed :P) and it wipes the folder clean



How to fix this?

Considering the amount of legacy code which can't be modified, we need a patch in bash itself. Fortunately, a workaround is provided by RedHat here.
Sysadmins make sure that you apply this patch if you don't want to get fired :P

Worth Reading


Bash 'shellshock' bug is wormable

​'Bigger than Heartbleed': Bash bug could leave IT systems in shellshock



Wednesday, 17 September 2014

42.zip - Zip Bomb!

I was reading online sometime back and I came across this really interesting thing called 42.zip also known as Zip Bomb, Zip of Death, Peta bomb or decompression bomb.

The file is only 42,374 bytes (42KB). When unzipped it becomes 4,503,599,626,321,920 bytes (4.5 Peta Bytes)!!!

The main use of it is to render useless the host reading the file, usually to disable antivirus. When you unzip it, the antivirus will be busy scanning the unzipped files, sucking up all the available resources and a malicious program injected can execute itself undetected!

How it works?
42.zip has 16 zipped files.
Each of these 16 have 16 zipped files.
Each of these have 16 zipped files.
Each of these have 16 zipped files.
Each of these have 16 zipped files.
Each of these have 1 file, with the size 4.3GB

Still. How is this level of compression achieved??
It relies on repetition of identical files!! Think of it as same file being unzipped over and over again.
Awesome isn't it?!



Also read Fork Bomb.

Tuesday, 2 September 2014

Convert Little-endian UTF-16 to ascii

I took a csv export from mssql. I had to read this file in python. However there was a problem. Python was reading it in binary format.

file.readlines read it like this:

'\xff\xfe2\x000\x001\x003\x00-\x001\x000\x00-\x001\x000\x00 \x000\x000\x00:\x000\x002\x00:\x000\x000\x00,\x00i\x00n\x00s\x00t\x00a\x00l\x00l\x00 \x002\x000\x001\x003\x00,\x00t\x00o\x00o\x00k\x00 \x00r\x00a\x00\r\x00\n'

When i used file command on that file I got:

Little-endian UTF-16 Unicode text, with very long lines, with CRLF, CR line terminators

When I tried to use dos2unix command I got this error:

dos2unix: Binary symbol 0x000B found at line 9419305
dos2unix: Skipping binary file calls.csv

So I tried iconv command to convert the file to urf-8

iconv -f utf-16 -t utf-8 input_file > output_file

And it worked! Now python reads it properly.


Open file in existing gvim in new tab

We know that gvim -p can be used to open multiple files together in different tabs in gvim. However if you want to open a file in a new tab in the existing gvim session "gvim -p" wont do any good. For that we can use client server concept available in gvim. Add the following line in "~/.bashrc" file and you are good to go!

alias gvim='gvim --servername gViM --remote-tab'

Now you can simply give gvim [file(s)] to open in new tab in the existing gvim session!

Friday, 29 August 2014

My tiny contribution for a prosperous digital age

I got my first salary few days back. I could think of hundreds of ways to spend that money. But I wanted to do something else, something I've always wanted to do. I donated a tiny amount of my money to Wikipedia. I didn't stop there. I have contributed to open source earlier too, but only in the form of code. I felt that it is time for me to contribute monetarily. I made donations to Ubuntu foundation and Tor project. The amount of joy I got out of doing this was unfathomable and I am sure that nothing else would've made me more happy.




I have decided to spend a tiny percentage of my salary to donate for such organizations every month. I believe that donating as little as $2 each can shape a better and prosperous digital age. And I think people like me who are in their early 20s with absolutely no responsibility to bear should step up and do this too. Here is a list of organizations which could use your donations:

Wikimedia Foundation - Makers of Wikipedia and wikia. Providing free access to the sum of all human knowledge to every single person on the planet.

Ubuntu foundation - On a mission to make linux desktop reach the common man.

Tor project - Anonymity online.

GNU Project - Father of the concept of free software.

The Apache Software Foundation - There are no words to describe their contribution to free and open source software.

The document foundation - makers of Libreoffice.

NOTE: I will keep updating the list.

Wednesday, 27 August 2014

Android L theme on Cyanogenmod 11

After Google announced that the new Material Design is going to be adopted on Android's next release, currently codenamed Android L; lot of us have wanted to try it. Unfortunately it (dev version) is available only for nexus 5 and 7.  Thankfully there is Android L theme by tung91 on google play which brings near Android L experience to other users.

You can try Android L or Android L Dark.
This is how it looks like on my nexus 4:








Decrease the size of navigation bar on Nexus

I feel that the default size of navigation bar is too huge and it occupies a lot of space on the screen. There is a simple way in which you can change the size of it if your phone is rooted.

Step1


Install Xposed Installer. Go to Framework and install neXus navbarz. Then select it and restart the device.

Step2


Open neXus navbarz. Go to navbar options and set navbar height! Restart the phone to see the change!




Tuesday, 26 August 2014

Google Calendar sync fails after deleting stock calendar app in CM11

I installed CM11 on my Nexus 4. After I installed Google Calendar, I thought deleting stock AOSP calendar app and few other depending apps wont hurt. Unfortunately Google calendar sync stopped working after that. "Calendars to display" was empty and "Calendars to sync" never completed loading. When I searched for solution for this online, people suggested to do a reset; which I didn't want to do. So I tried reinstalling the default AOSP calendar app. It fixed the problem!!!

Download the following apks and install them on your phone.

GoogleCalendarSyncAdapter.apk
SecCalendar.apk
SecCalendarProvider.apk

Update
Some people say that they face the following error while signing in.

"Couldn't sign in. There was a problem communicating with Google servers. Try again later"

After installing the above apks, if you open the calendar app directly you will get this error. You have to restart the phone to fix it.

Thursday, 21 August 2014

Backspace doesn't work on vi in cygwin

Unfortunately I am forced to use windows at work. So I installed cygwin to run linux commands. While editing using my favourite editor vim; I realized that backspace doesn't work at all! However I found out a simple way to fix it. Add the following line to .vimrc or .virc

set backspace=indent,eol,start

Now backspace magically works!

Later I found out that this is not just in cygwin and is pretty common in unix based systems.

Monday, 18 August 2014

Beauty of shopt

shopt is a builtin command which can be used to customize the way you interact with terminal is several ways. Some of them are:

Ignore typos in path while changing directory

Say you want to go to /home/alse/path and you type /home/alse/paht instead, the following command will intelligently take you to /home/alse/path

shopt -s cdspell

Make commands case insensitive in linux

To be frank I like case sensitiveness of commands in linux unlike in windows command prompt. It makes you more careful while writing scripts. However I know some people who would like case in-sensitiveness.
It is possible to do this using shopt command.

shopt -s  nocaseglob

Remove the need of 'cd' while changing directory

Tired of typing cd command before path? Try this

shopt -s autocd

Now you can simply type the path to go to that directory.

Store Multi-line commands in history

See this blog post http://lifepluslinux.blogspot.in/2014/08/storing-multi-line-commands-in-history.html

shopt -s lithist

Mail warn

If set, and a file that Bash is checking for mail has been accessed since the last time it was checked, the message "The mail in mailfile has been read" is displayed.

shopt -s mailwarn

SIGHUP by default

Bash will send SIGHUP to all jobs when an interactive login shell exits.

shopt -s huponexit


Storing Multi-line commands in history using shopt

It is hard to reuse multi-line commands as the newlines are replaced by semicolon and the many line command is converted to a single line. For example:

for i in $( ls *.txt)
do
pwd
echo $i
cp $i /bin
done

After executing it, when you press up button to reuse it, the command becomes:

for i in $( ls *.txt); do pwd; echo $i; cp $i /bin; done

Forget about reusing, I cant even understand what it does when so many things are stuffed in one line!
I found a way using which it is possible to retain the newlines in history using shopt.

shopt -s lithist

Now when you press up button you will see the command in multiple lines! win!

If you want this to be enabled by default add "shopt -s lithist" at the end of file ~/.bashrc


UPDATE
Also multi-line commands are screwed up when you add comments. For example

for i in $(ls)
do
echo "a"
#echo $i
done

becomes for i in $(ls); do echo "a" done (note that there is no semicolon after echo "a". Hence it takes echo "a" done as one command). Hence you will end up scratching your head to figure out what went wrong :P




Can't safely remove USB drive. Device busy!

We have seen cases where we are not allowed to safely remove or eject USB drive because of the fact that some process is using resources on the drive. The easy way to get out of this is to kill the process which is doing this. For example if the problem is the result of stalled file copying (say, using nautilus) then killall nautilus should do the trick. However it happens that sometimes it is not possible to figure out which process is accessing the USB drive. So how do we find the rogue process(es)?

fuser to the rescue!

fuser -k -15 -m  /dev/sdb1

The above command will kill all the processes accessing your device! Replace /dev/sdb1 with the device file corresponding to your USB device.

Now try ejecting/ safely removing. It will mostly work! 

Monday, 11 August 2014

Dry-run package installation without installing them

Sometimes we might want to perform a 'dry-run' of package installations without actually installing them in order to prevent unwanted changes from happening. It is very much possible and is highly recommended specially while installing packages from untrusted sources. So do this before installing anything:

$ apt-get install --dry-run [package]

If you have a debian (.deb) package already and would like to see what changes it is going to make, do this:

$ dpkg --dry-run -i package.deb

This will definitely save you someday!

Friday, 8 August 2014

Send exe files through gmail using steganography

Mails used to be the easiest way to spread malware. So obviously Gmail doesn't allow users to attach windows executables (.exe) to mails in order to protect it's users from screwing up their windows machines. However, we may have to send .exe files which are not malware via mail. Before, you could've just renamed the extension from .exe to something else or made a zip/rar archive and gmail would simply allow you to attach it. Sadly, it doesn't work anymore as gmail started reading file headers of attachments and started reading files inside zip/rar archives.

So I figured out a simple way to do this using steganography. The idea here is to embed the exe file inside any image and attach it to the mail. Gmail will think that it is just an image and will be oblivious to the fact that there is an exe file hidden inside that. Later the other user can simply extract the exe file from the image and use it .

Usage

Download mailexe (Don't forget to make it executable).

Sending


$ ./mailexe -e  [exe file] [image file]

A file called image.png will be created. This image file has exe file hidden in it. Send this via gmail.

Receiving


$ ./mailexe -d [original image] [duplicate image]

A file called output.exe will be created. This is exe file which had to be sent!!!!! Congrats!


How it works?

Sending

Step1

Convert the image and the executable to base64 and save it in a file

$ base64 [image file] > temp
$ base64 [exe file] >> temp

Step2

Decode base64 file and save it as image

$ base64 -d temp > image.png

Step3

Send image.png and the original image file via gmail

Receiving

Step 1 

Download both the images and convert both of them to base64 and extract that base64 part of exe file.

$ base64 [original image] >original
$ base64 [duplicate image] >duplicate
$ diff -ed original duplicate >diffed
$ tail -n +2 diffed |head -n -1 >exe.64

Step2

Now convert extracted base64 to exe

$ base64 -d exe.64 > output.exe

Now you can simply run the exe file.



Friday, 23 May 2014

Password protect files on fly using crypt-editor


I always wanted an editor which can help me edit text securely with password protection using which I can easily create, save, edit files on fly. I am sure that there are some editors which can do it. However I felt that instead of an editor, it is better to have an interface which will allow me to edit files using my favorite editor while password protecting it. So I wrote a script called crypt-editor which uses gpg/mcrypt to encrypt and decrypt files enabling users to edit files using any editor.


Fork me on Github

Usage

Say you want to create/open a file using gedit:
crypt-editor gedit [filename]
You will be asked to enter the passphrase. Then gpg/mcrypt decrypts the file (if already exists) and opens it with gedit. On closing the file gpg/mcrypt encrypts it back and deletes the decrypted file.
If you do not specify the editor, the file is opened in vi editor (my favorite so it is default :P)
crypt-editor [filename]
Complete option list of crypt-editor:
crypt-editor -help
crypt-editor [filename]
crypt-editor [editor] [filename]
crypt-editor [-k key] [filename]
crypt-editor [-k key] [editor] [filename]

To create new file with mcrypt instead of gpg use -m option
crypt-editor -m [filename]

Examples:
crypt-editor passwords
crypt-editor gedit passwords
crypt-editor -k pa$$word passwords
crypt-editor -k pa$$word gvim passwords


Installation

Setting up crypt-editor is simple and straight forward.
git clone https://github.com/alseambusher/crypt-editor
cp crypt-editor/crypt-editor /usr/bin
If you want to use mcrypt instead of gpg, you have to install mcrypt.
apt-get install mcrypt

Say Thanks to birthday wishes on Facebook automatically

One of the main reasons why people turn into computer geeks is because they are lazy :P Yesterday was my birthday. Again, thanks for all the wishes :) However I was lazy to manually thank each and every post on my Facebook wall. So I wrote a simple python script using Facebook graph API to say thanks to each of them. I didn't stop there. I am aware that many people think that thanking people manually is something that has always been very tiring. So I searched for all the simpler alternatives available to do this task and found that there was a Facebook app called "Say Thank You". It is simple and neat. However, it requires people to give access to post, like, get friend list..etc. Well, that is a mini privacy invasion :P. So it is a not a good alternative. Also in future Facebook might think that it is doing something against their policies..blah blah blah and bring it down. So not a permanent solution either.
Hence I decided to rewrite the script I had written in python to javascript to make it accessible online. Well, here it is:

http://alseambusher.github.io/say-thanks/

For this you will need to get the access token. Getting access token is simple:

  • Go to developers.facebook.com.
  • Under Tools in the menu, go to Graph explorer.
  • Click on Get Access Token if access token isn't there already.

Note that as this runs completely on the client side, users can safely use it without giving access to anybody (Although it requires you to give access token, it is not stored anywhere. See source ). And access tokens expire after sometime.


Sunday, 27 April 2014

Enable Tree View in Ubuntu 14.04

I updated to ubuntu 14.04 recently. I was very disappointed when I came to know that the awesome "tree view" was not available in nautilus. I searched online to find if there was any way to get it back. Most suggested to switch to older version of nautilus, which is simply absurd. So I decided to figure out a way myself and I did.
To switch to tree view first install dconf-editor.

sudo apt-get install dconf-editor


Then open dconf-editor. Go to org -> gnome -> nautilus -> list-view and check use-tree-view.

 Now your list view is tree view.

Friday, 14 March 2014

Unbuffer to the rescue

Today I was running a c program which had to print lot of text on the terminal. However after some time it execution used to halt which seemed to be for no reason. This happens because whenever you write something to stdout, it stores it into a buffer till the process gets executed completely. To prevent buffering we can use unbuffer. This did the trick for me:

unbuffer ./a.out 

Whenever you redirect some command's output to a file, the output is first stored in buffer and then it s written to the file. Sometimes you may want to avoid this. Specially when the command is generating output continuously.

unbuffer [command] > [file]

In order to install it on debian or Ubuntu:

sudo apt-get install unbuffer