Home Linux Community Community Blogs

Community Blogs

Some Useful VI Tips

vi tips that I find useful.

 :make will run the make file in the current directory, and load the file where the first error occurs at the location that the first error occurs


% will match brackets.

=% will indent brackets and braces (very useful)

:e. will select a file to edit from the working directory

 Some more general VI tips

To move your cursor without having to move your hands, use hjkl where h is left, j is up, k is down and l is left. This is also used when switching between windows after doing ctrl-w.

 go to a line


will go to line 10000



/find text


(note that no colon is needed)


search and replace

:%s/find text/replace text/g


the g at the end means global. 


 ctrl-w ctrl-s  

ctrl-w is window command mode, ctrl-s is split horizantlaly

 after that you can

edit a new file

:e file

or go to the next buffer if you are already editing more then one file


To search for a file edit the directory

:e .

 this will allow you to select a file from within the directory. (use hjkl to move around)


To repeat a command use a period. For example if you inserted some text, then moved to another part in the file, pushing . will insert the text again.

 Macro Record

q letter edit sequence q

Macro playback

@ letter


Common letter commands

i is insert

I is insert from the beginning of the line

a is append after the current letter

A is append at the end of the line.





Windows 7 & Ubuntu 9.04

Well, congratulations for the launch. Now onto other things.

I bought a new PC, and it just came in. Installed Windows 7 and Jaunty, both 64 bit editions. I must say I am equally impressed by MS and Canonical. Windows 7 picked up my wireless out of the box. This has never happened before for me. I'm not doing a review, so I'll sum it in little. 7 is what Vista should've been. And it's good. It's streamlined, less resource hungry, and just a nicer experience. The interfaces are intuitive, but a little awkward to use. Other than that I must say 7 is nice.

 Ubuntu too, installed fast, easy to upgrade, supported my wireless out of the box. Nvidia was easy to configure with restricted drivers. It's easy to navigate, install apps, fast, and not at all resource hungry. Good job.

 Overall both systems are nice, and I suggest you try Windows 7 if you're able.



Nice layout :)



Hello World

So here I am, on I don't expect to use this blog much, since I don't have the energy to manage multiple blogs. Would sure be nice if I could just pipe the "Ubuntu" or "Linux" categories from my real blog into here, but such is life. Nevertheless, I hope this site does well. It looks promising.

–ü–¡—Ä–≀—ã–π –ø—Å—Ç–æ

β€“Γ³β€“βˆžβ€“Β±β€“βˆžβ€“β‰€β€“Ξ©β€”Γ£β€“Ο€ –Β₯β€“βˆβ€“βˆ‘β€“βˆžβ€“Ο€β€“Ξ©)) β€”Γ’β€“βˆžβ€”Γ… β€“βˆ«β€”Γ…β€”Γ‡β€“βˆžβ€”Γ‡β€“βˆ –Β₯β€”Γ‰β€“ΒΊβ€“βˆžβ€”Γ© β€”Γ…β€”Γ‡β€“βˆžβ€“β‰€β€“βˆβ€”Γ‡β€”Γ₯ –Βͺβ€“βˆ –Ω–æ–≀—ã–π —É–±—É–Ω—Ç—É β€“Ξ©β€“βˆž —Å–≀–æ—é β€“ΒΊβ€“βˆžβ€”Γ β€“βˆβ€“Ξ©β€”Γ‰? β€”Γ…β€“Β΅β€“Ο€β€”Γ‘β€“βˆžβ€”Γ… β€”Γ‰ –º–¡–Ω—è β€”Γ‰β€”Γ…β€”Γ‡β€“βˆžβ€“Ξ©β€“Γ¦β€“β‰€β€“Βͺ–¡–Ω crunchbang.. –Ω–æ –æ–Ω –º–Ω–¡ β€”Γ‰β€“βˆ‚β€“Β΅β€“Ξ© β€“Ξ©β€“βˆžβ€“Β₯–æ–¡–Βͺ)) —Ö–æ—Ñ—É —É–±—É–Ω—Ç—É.. β€“βˆ –Ω–æ–≀—ã–π β€“ΒΊβ€“Γ¦β€“Ξ©β€“βˆβ€”Γ‡β€“Γ¦β€”Γ„.. β€“βˆ –Ω–æ–≀—ã–π β€“βˆ«β€“Γ¦β€“ΒΊβ€“ΓΈ))) –Β₯β€”Γ‰β€“ΒΊβ€“βˆžβ€”Γ© β€“βˆ‘β€“βˆžβ€“βˆ«β€“βˆžβ€“βˆ‚β€”Γ‰ β€“βˆ«β€“βˆžβ€“βˆ«-β€“Ξ©β€“βˆβ€“Β±β€”Γ‰β€“Β₯β€”Γ₯ —Å–¡—Ä–≀–¡—Ä–Ω—É—é β€”Γ‘β€“βˆžβ€”Γ…β€”Γ‡β€”Γ₯ β€“βˆ«β€“Γ¦β€“β‰₯–Β₯β€“βˆž –Ω–¡ –≀–Βͺ–æ–º –±—É–Β₯–¡—Ç —Ä—ç–β‰₯–Ω—É—Ç—Γ₯β€”Γ…β€”Γ¨ β€“Ξ©β€“βˆž β€”Γ…β€“βˆžβ€“Ο€β€”Γ‡β€“Β΅ β€“βˆ‘β€“βˆžβ€“βˆ«β€“βˆžβ€“βˆ‘β€“βˆž.

Enemies of Change

I understand people using Linux and not liking it.  what i don't get are people who will refuse to even think about testing it just because it is free and there is no way it can be as good as proprietary OS's. no matter how hard you try, how many cool screenshots or videos you show them, or how much you spend time explaining to them, they just can't seem to understand how a free software or OS can be as good or even better than the ONLY system they used their whole life.

 Have you had that type of people in your life? did anything you did or said make a difference at the end?


please share your thoughts .


How to Merge Subtitles to a Movie

My refusal to use Windows is what makes me learn to do everything using only Linux, even though it usually requires long times in front of the computer researching and tweaking the hints gives me. But, at least I can say that at the end the results are satisfying, I end up learning more about Linux and how powerful a command line application can be compared to a most GUI application. I must admit that I do prefer GUI in the majority of the cases, is just that from time to time I am amazed by the power of the CLI. My latest adventure was learning how to merge a .srt (movie subtitle file) with a .avi (movie file). How I did it? Well, first we need to have mplayer installed, which on Arch Linux can be done as follows:

# pacman -Sy mplayer codecs

After that you might need to create the mplayer folder (if it isn't there already) so we can add the fonts we would like to use for the displaying of the subtitles in the movie, with that purpose we issue the following command:

$ mkdir .mplayer && cp /usr/share/fonts/TTF/LiberationSans-Regular.ttf .mplayer/subfont.ttf

Change the LiberationSans-Regular.ttf with the font you want to use. If you want to use the Liberation font, install the ttf-liberation package which is available in the community repository.

# pacman -Sy ttf-liberation

OK, we have gone a bit off the curse here with the fonts thing, but by now we should have the mencoder application installed, hopefully this makes us still on track for the merging that is about to happen. The mencoder application is part of the mplayer application we just installed, mencoder is the tool we are going to use to merge the subtitles with the movie. Now, to the better part of this tutorial, how we merge the subtitles with the movie files, the following script should do the trick:

$ mencoder -o fileiwantatend.avi -sub -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell theactualmovie.avi

The first .avi we refer to in the above script is the file we want to create at the end of the merge (the resulting file), which could be named movie_subtitle.avi, now, the .srt file referred to in the script is the subtitles file which do not necessarily need to be on .srt format, it could be for example in .sub format, and the latests .avi file referred to in the command is the original movie file which you want to merge with the subtitles.

This command is very simple and has few options so it preserves the original movie file quality without much alterations, if any.
# = as root
$ = as user


Useful tool for passwords generation

pwgen - generate pronounceable passwords

Example of usage:
pwgen -A1 13
A - use small case
1 - one pass per line
13 - count of symbols in pass

Controlling fan rpm in Dell laptops

1. Download the tar zipped file from dellfand's site (, unzip it, cd into the folder and run 'make'. This produces the executable. You have done this already.

2. As root, copy the executable to /usr/local/bin.

3. Put this line in /etc/rc.local to have it run on boot.
/usr/local/bin/dellfand 1 0.5 40 50 55

The above will run dellfand as a daemon( the parameter 1), with a sleep time of 0.5 seconds(parameter 2) with an off,low and high temperatues of 40, 50 and 55. Change the temperatures to the ones that suit you.

P.S: The BIOS in some laptops, with some BIOS versions, is more active than in others. You may get interference. It could be that reducing the polling delay (e.g. to 0.5 seconds) will reduce the annoyance caused by this. Currently I know of no other solution.


reinventing the wheel...again...and again...

Congratulations on the new!  I know it was tons of hard work.

 And that's why I'm blogging this thought.  How many upgrades and migrations have you done in your career?  Too many, if you're like me.  Seldom is there any automatic migration script that can just handle everything, esp. when big monopoly-like companies are involved.  (You know who.)

The only time I've seen a good migration is when the company that wrote the new program gets some money if you switch.  Then, a good migration path is a selling point.

 So, back to the site.  It's written in Joomla, I understand.  Cool.  I don't honestly care, except that I'm learning django right now.  And what happens if we need to move our projects from django to Joomla, or to any other framework?  Lots of rewriting.  Lots of reinventing the wheel.

 Sure, it's not as big a wheel as it was, back in the GUI days.  HTML, CSS, Javascript are all pretty standard.  Still, we write these little wheels, and have to reinvent them whenever we change language, database, OS (oops! that server wasn't running linux?!), etc.  When are we going to get smarter?

 I propose that we do one very simple thing:

Be explicit.

 If you're programming in a language, then please embed a comment to what language it is, the version, and--most importantly--where I can find the language specification and a reference implementation of the compiler/interpreter.  Better yet, provide a BNF notation and an explanation of the Abstract Syntax Tree.  (What?  You're using a language that's not open, or isn't well-documented? Don't make me come over there!)

 If you're encoding data in XML, PLEASE, PLEASE provide a reference to the DTD or Schema definition.  IHMO, that silly URL in XML that tells what namespace it's in should actually reference a valid document.  Most of the time, if you try to open that URL, you get nothing.  (This was just bad design on the side of the XML designers.)

 What I want is this: Perfect parsers.  The only way that's going to happen is for the code and data to be explicitly defined.  (And, yes, you can do this with dynamic languages.)  But once you have perfect parsers, voila!--you have much easier time migrating data and code.  In fact, maybe it wouldn't be that hard to write migration programs.  But that's another blog entry...

Page 135 of 140

Upcoming Linux Foundation Courses

  1. LFS426 Linux Performance Tuning
    08 Sep » 11 Sep - New York
  2. LFS520 OpenStack Cloud Architecture and Deployment
    08 Sep » 11 Sep - Virtual
  3. LFD320 Linux Kernel Internals and Debugging
    15 Sep » 19 Sep - Virtual

View All Upcoming Courses

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board