Command History in Far Manager

Far Manager has powerful suppport for command history. ConEmu author even suggests using Far Manager with panels turned off instead of standard command prompt.

Ctrl+E gives you previous command entered. You can press it multiple times to get older entries. Ctrl+X moves you forward in the history.

Press Alt+F8 to view command history in the list:

You can execute a command from the list by pressing Enter. If you want to edit a command press Ctrl+Enter.

All shortcuts available in command history list:

Enter Re-execute a command
Shift+Enter Re-execute a command in a new window
Ctrl+Alt+Enter Re-execute a command as administrator
Ctrl+Enter Copy a command to the command line
Del Clear the commands history
Ins Lock/unlock a history item
Shift+Del Delete the current history item
Ctrl+C or Ctrl+Ins Copy the text of the current command to clipboard

Another useful shortcut is Ctrl+Alt+F – it lets you to search in the list by filtering it down. This shortcut is totally non-obvious and not documented anywhere so I was happy when I discovered it. It also works in folder history (Alt+F12).

My Experience with Vipassana Meditation

I did 10-day Vipassana meditation course in July 2012. Meditation centre was located in Woori Yallock – small town near Melbourne.

First of all, my notion of meditation was shattered there. In my mind, meditation was sitting quietly and relaxing, something like this:


Well you do sit quietly but it is not relaxing at all, at least not in Vipassana meditation. It is hard work. It is simple but not easy at all.

What helped me is that I decided to allow myself to be a newbie. I said to myself: “It’s OK to do it poorly it the beginning”.

There were about 40 students total. Men and women were living in separate areas.

Talking to each other was not allowed. Many people told me that this would be very hard for them. However I didn’t find it difficult at all. Maybe this is because I was not a very sociable person.

Also there was no Internet, no TV, no radio, no phones, no visitors. I handed in my mobile phone in the beginning of the course for safe keeping. There was no communication with outside world at all.

We didn’t read anything. There were no writing materials. Actually I missed pen and paper during the first half of the course. I was getting so many excellent ideas during meditation and I wanted to write them down so that I don’t forget them.

We were spending a lot of time meditating. Here is typical timetable:

4:00 Morning wake-up bell
4:30-6:30 Meditate in the hall or in your room
6:30-8:00 Breakfast break
8:00-9:00 Group meditation in the hall
9:00-11:00 Meditate in the hall or in your room according to the teacher’s instructions
11:00-12:00 Lunch break
12:00-13:00 Rest and interviews with the teacher
13:00-14:30 Meditate in the hall or in your room
14:30-15:30 Group meditation in the hall
15:30-17:00 Meditate in the hall or in your own room according to the teacher’s instructions
17:00-18:00 Tea break
18:00-19:00 Group meditation in the hall
19:00-20:15 Teacher’s Discourse in the hall
20:15-21:00 Group meditation in the hall
21:00-21:30 Question time in the hall
21:30 Retire to your own room – Lights out

Getting up at 4 am in the morning was hard for me. In the beginning I was walking during rest times but later on I was trying to get as much sleep as possible. Walking, by the way, is the only form of exercising allowed.

We had breakfast and lunch but no dinner. Instead of dinner we had two pieces of fruit and tea. Somehow I didn’t miss dinners and wasn’t particularly hungry in evenings. The food was delicious, I liked it very much. Oh, and it was all vegetarian.

Meditating itself wasn’t in complete silence. In the beginning and the end of each session there was chanting played as recording. I found it strange at first but with time grew to almost like it.

I would never associate meditation with pain. Yet initially I experienced a lot of pain and discomfort. Sitting without moving for long time becomes painful. Later on I found out that in fact you can change posture from time to time. So I didn’t have to go through all this suffering. Oh well, I still think it was beneficial for me.

The main idea of Vipassana meditation is observe different sensation on your body while maintaining “perfect equanimity”. You try to be aware of your body.

In the evening the teacher discourse was given. This was recordings of S.N. Goenka, a leading teacher of Vipassana meditation. This is where theory behind the meditation was given.
At the start of the course management strongly recommended me to listen to discourse in my first language (Russian). I was glad I agreed because the material was quite thick. It was hard for me to follow it even in Russian. My English was definitely not good enough to follow discourse in English.

The theory included subatomic parts, vibrations and future lives which was hard to swallow for me raised in atheistic Soviet Union.

On day 8 I finally became aware of my leg. It was fascinating – it felt like my leg lit up with sensations like a Christmas tree. Immediately after that I was able to get a flow of subtle sensations which felt incredible. I can compare it to the opening sequence from Universal Studios logo:

I felt ecstatic after that and couldn’t stop smiling 🙂 I must admit that I couldn’t get that flow again since then.

Surprisingly I got many revelations about my life during last days of the course. I realized how misguided I was in many aspects of my life. I understood why I behaved in certain ways.

On the last day I felt very happy and was eager to talk to fellow students. I think everybody else felt blissful.

Overall the course was great. I strongly recommend it to everyone. What I like about Vipassana meditation is that it helps everyone, regardless of their religion, race, age and background.

It is hard, sometimes even gruelling but it is very beneficial. I think it’s like a boot camp for your mind. You can find more about it at Vipassana website.

Far Manager and Console Output

One of the strongest features of Far Manager is the ability to start any program or script from command prompt. You can type anything there, just like in standard command prompt. Ctrl+Enter shortcut greatly helps here – it inserts selected file name to command prompt (Ctrl+F inserts full path).

If you launch a console program all program output will be displayed in Far window. Terrific! After program finishes you can view console output by pressing Ctrl+O.

There is a problem however: you can’t scroll up if program output is long. Only last 25 or so lines of text are visible. Anything before that is lost forever.

Far has a clever little known trick to view all program output. Add view:< before the command and all console output will be intercepted and redirected to internal viewer. For example:

view:<ipconfig /all

You can even redirect output to Far editor by using

edit:<ipconfig /all

This is nice but not ideal. You have to remember to add view:< before starting a console program or script. If a program takes long time to execute you won’t see any progress until it finishes. Also any interactive prompt in program screws the whole process.

ConEmu to the Rescue

ConEmu is a console emulator. It has lots of great enhancements to standard Windows command prompt. It works by intercepting all console output and displaying it in its own window.

ConEmu is also a close friend with Far Manager. After installing ConEmu you can open Far Manager inside ConEmu window:

Far Manager in ConEmu

Once Far Manager is inside ConEmu tab you can scroll console output by switching to so called alternative mode.

This mode hides Far panels and ‘freezes’ console. Ctrl+Up scrolls up, Ctrl+Down scrolls down. Scrolling with a mouse wheel also works.

But that’s not all. You can also assign Ctrl+O to view console output in Far viewer. To do this locate CtrlO_View.reg in ConEmu folder and execute it.


Scott Hanselman on ConEmu

PowerShell Exit Codes

Recently I came across an interesting quirk in PowerShell: exit codes from powershell.exe are inconsistent.

As you may know there are two ways of launching PowerShell script: you can use -File or -Command parameter.

powershell -File test.ps1


powershell -Command .\test.ps1

-Command could be ommitted:

powershell .\test.ps1

Now let’s say you want to execute PowerShell script from a scheduled task or from continuous integration server. Naturally, you would be interested if the script fails or not.

And here’s the bug: if you launch your script using -File parameter powershell.exe exits with zero code even if there was an exception.

You can confirm this by creating a script that always throws an error:

throw 'oops'

Now if you launch it using -File parameter exit code is 0:

powershell.exe -File testerror.ps1
echo Error level is %ERRORLEVEL%

At C:\testerror.ps1:1 char:6
+ throw <<<<  'oops'
    + CategoryInfo          : OperationStopped: (oops:String) [], RuntimeException
    + FullyQualifiedErrorId : oops

Error level is 0

But if you use -Command parameter exit code is set as expected:

powershell.exe -Command .\testerror.ps1
echo Error level is %ERRORLEVEL%

Chris Oldwood also came across this bug:

depending on whether I use the “-File” or “-Command” switch to execute the .ps1 script I get different behaviour. Is this a PowerShell bug or is there something fundamental about the execution model the differs between -File and -Command that I’ve yet to understand?


How to execute PowerShell script from NAnt script:

<exec program="powershell.exe" append="true">
  <arg value="-noprofile" />
  <arg value="&amp;'C:\your-script.ps1'" />
  <arg value="param1" />
  <arg value="'param 2 with spaces'" />


Far Manager and Quotes

Far Manager has two keyboard shortcuts to copy file name to clipboard:

  • Ctrl+Ins copies selected file name
  • Alt+Shift+Ins copies full path to selected file

These shortcuts also work if multiple files are selected which is great for creating batch renames.

Let’s say file name contains spaces. In this case Far Manager adds quotes around file name. Supposedly this saves time if you construct some command line somewhere. Personally I find this totally unnecessary. I can add quotes myself, thank you very much.

Here’s how to disable this behaviour:

  1. Open HKEY_CURRENT_USER\Software\Far2\System
  2. Create QuotedName as DWORD value
  3. Set it to 1

Official documentation for this feature is a bit obscure:

File or folder names, containing characters specified in rule  34,  will
be quoted when inserted into the editor/command line or the clipboard.
The key "System/QuotedName" of DWORD type controls this behaviour.
  0 - if set then file or folder names will be quoted inserted into
      the editor/command line.
  1 - if set then file or folder names will be quoted inserted into
      the clipboard.
The default value = 0xFFFFFFFF (quote file or folders names).

I think you need to be a developer to understand this.

Note two similar shortcuts:

  • Ctrl+Enter copies selected file name to command line
  • Ctrl+F copies full path

For this auto-quoting is actually useful, therefore I set QuotedName to 1, not 0.

How to open HTML files with Visual Studio from Far Manager

Occasionally I want to edit plain HTML file in Visual Studio. You know, those files with .htm or .html extension. Normally pressing Enter in Far Manager opens them in a browser. This is what I want most of the time, so let’s keep it.

Idea: let’s use F4 key to open file in Visual Studio.

Here’s how to achieve it:

* Open Commands menu, select File associations.
* Add new association, enter *.htm;*.html as a mask. Enter this command for F4:

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /edit "!.!"

Change path to devenv.exe if you have different version of Visual Studio.

Note the /edit parameter. It makes Visual Studio to re-use existing window if it is alredy running. Visual Studio is not exactly a lightweight editor so let’s be efficient here.

What if you want to open HTML file in internal Far editor? Simple: press Alft+F4.


Devenv Command Line Switches

Solyanka Recipe

Solyanka is a traditional Russian soup, very tasty. This recipe is from cooking site, translated from Russian.



  • 700 g beef
  • 6-10 types of ham, smoked ribs, sausages, salami, hot dogs, small sausages etc. Total weight 1 kg.
  • 150 g carrot
  • 150 g onion
  • 200 g pickled cucumbers
  • 5 tablespoons tomato paste
  • 3 tablespoons capers
  • black pepper
  • 3-4 bay leaves
  • vegetable oil
  • 1 lemon
  • olives to taste
  • dill or parsley


Place beef in a pan. Bring to a boil, cover and simmer for one and half hour (on medium, skim off the scum).

Take the meat out, let it cool, chop into small pieces.

Chop onion.

Grate carrot on medium grater.

Dice cucumbers.

Dice or julienne meat items (cervelat, ham, smoked ribs, sausages, salami, hot dogs, small sausages, bacon etc).

Fry meat items slightly on vegetable oil.

Fry onion slightly on vegetable oil.

Add carrot, fry a bit.

Add cucumbers, fry for 2-3 minutes.

Add tomato paste, simmer for 5-7 minutes on low.

If tomato paste is too thick you can add some water.

Add meat items to the boiling stock.

Then add beef. Simmer for 5-7 minutes.

Add few capers to taste.

Add fried onion, carrot and cucumbers.

Add half of cup of cucumber or olive pickle. Simmer for 5-7 minutes more.

Add bay leaves, pepper, dill, parsley.

Add salt if needed. Leave it covered for 15-20 minutes. Remove bay leaves.

Pour soup into bowls. Put lemon and olives into each bowl.


Improving backup to Amazon S3

I use s3.exe command line utility to backup photos to Amazon Simple Storage (S3) and it works great.

I have lots of photos to backup: 900,000 files in 4,000 folders.

Obivously it is impractical to copy all files on every backup – it will take forever. s3.exe has exact feature that I need:

/sync is used with the put command and only uploads files that do not exist on S3 or have been modified since last being uploaded, based on the timestamp. It can be used alone or in conjunction with the /sub option for a fast incremental backup of a whole directory.

Here’s command line that I use for backups:

s3.exe put mybucket C:\photos\ /sub:withdelete /sync /acl:public-read /yes /nogui


When I started using S3 however I was surpised with the bill from Amazon.

Let’s open source code to see how backup is done. Here are relevant bits:

foreach (string file in Sub.GetFiles(directory, filename, sub))
DateTime? lastModified = svc.getLastModified(bucket, key);
if (lastModified.HasValue && lastModified.Value > File.GetLastWriteTimeUtc(file))
Progress.reportProgress(key, 0, 0);

For each file s3.exe gets last modified date from the storage. If it is greater than last modified date of local file then no upload is performed.

Let’s do some calculations. To get last modified date s3.exe sends HEAD request. Amazon charges $0.01 per 10,000 HEAD requests. So I would end up paying $0.09 every time I perform backup. If I do it every day that’s $27 per month.

Let’s try to optimize it. How about this: for every local folder get the corresponding list of files in storage. Last modified date will be included in response. Now we’re going to issue about 4,000 LIST requests (1 for each folder). 1,000 LIST requests is $0.01 so that would be $0.04 in total. Or $1.20 per month – that’s saving of $25.80 – a big win 🙂

Making the Patch

I have created a patch by following steps from Scott Hanselman’s blog post.

I have submitted my patch to Codeplex, let’s see if project owner decides that it’s good enough to be applied.

Progress so far

I have started working on my own business in December 2008. Here’s the progress so far.


Idea is very simple:  web gallery with shopping cart for wedding photographers. For more details see my older post.


Fotrel is a web application. My clients use it as a service. The whole software-as-a-service model has a great appeal to me. I can make money while I sleep. There is no pain of acquiring new clients.

I’ve set the price to $95 per month right from the beginning. I didn’t want my product to look cheap. On the other hand it is flat price. I don’t like the idea of charging commission for this kind of service. For some reason it feels like putting my hands in client’s pocket. After all, my expenses are exactly the same regardless of how many orders my client gets.

Then, after reading Jay Abraham’s book I got an idea: charge $95 per month only if photographer has sales in that month. This creates a safety net for my clients: if my product doesn’t bring profit to them at least they are not losing money on it. This should be especially appealing to small (one-person) studios. Also, when you have sales paying $95 feels like giving away part of the profit, not parting with your own money. So far people like this idea. It certainly makes it easier to say yes rather than no.


Not everyone pays me each month because of the pricing structure. So it is somewhat hard to tell if someone is my customer. A photographer could sign up for my service just to try it out and then never come back. I define my client as someone who has uploaded at least one wedding or portrait gallery in past 3 months.

At the moment I have 15 clients.


Profits chart

On average, I get $300 per month.


You might be wondering why I have those red months with negative profit.

  • I hired web designer twice.
  • I sponsored few AIPP mentoring sessions.

Hosting is the biggest part of my expenses at the moment – about $150 per month. I’m using Amazon EC2 and Softsys Hosting.


Overall, I’m happy with my progress. For now, my focus is on preventing those red bars from appearing again.

P.S. You can take a look at my product here: Fotrel.

Detaching Far Manager from long-running process on Windows 7

Occasionally I launch a program from Far Manager that takes very long to complete. Normally you can use Ctrl+Alt+Tab to “detach” Far from a running process. Technical note #27 explains this well:

If a long-running process (for example, archiving) was run in a FAR console, and for some reasons this very instance of FAR is needed (an editor in the background) or it is undesirable to run a new instance ofFAR, pressing this key combination will create a new console for FAR where it will continue running as if the process has already ended, and the process will continue working in the old console.

Unfortunately this doesn’t work on Windows 7. Instead of detaching you get Windows task switcher:

Windows 7 task switcher

Interestingly the switcher is in “sticky” mode. It doesn’t disappear when you release keys. You can use arrow keys to select a window.

The fix is easy:

  1. Start regedit, open HKCU\Software\far2\System key.
  2. Create ConsoleDetachKey string value, set it to some keyboard shortcut. I use CtrlAltX.
  3. Restart Far Manager

To test it try executing this command from Far:

ping -t

Press Ctrl+Alt+X to get back to Far without stopping pings.