February 11, 2011
You probably know about less: it is a standard tool that allows scrolling up and down in documents that do not fit on a single screen. Less has a very handy feature, which can be turned on by invoking it with the -i
flag. This causes less to ignore case when searching. For example, ‘udf’ will find ‘udf’, ‘UDF’, ‘UdF’, and any other combination of upper-case and lower-case. If you’re used to searching in a web browser, this is probably what you want. But less is even more clever than that. If your search pattern contains upper-case letters, the ignore-case feature will be disabled. So if you’re looking for ‘QXml’, you will not be bothered by matches for the lower-case ‘qxml’. (This is equivalent to ignorecase + smartcase in vim.)
So how do we take this useful feature and make it permanent, so that we don’t have to remember to type less -i
every time? We could create an alias less='less -i'
. But there are tools (such as git-log) that invoke less on their own, and they will not know about the ignore-case option. It would be better if we could tell less that we always want that feature on, regardless of startup flags. This article will teach you how to do that.
Read the rest of this entry »
3 Comments |
Linux, Shell | Tagged: case, config, configuration, flag, less, lesskey, startup, system-wide, tip, trick, unix, vim |
Permalink
Posted by Constantin
February 4, 2009
Tools that know they will take a long time often come with a built-in progress indicator, but there are other utilities on Linux that often leave the user frustratedly tapping their fingers, wondering how much longer they will have to wait.
Luckily, there is a nifty little tool called pv
that will donate a progress bar to any program that can read from standard input or a pipe. pv probably stands for pipe viewer.
1. Simple example: figure out how long an md5sum
will take:
pv eternal.avi |md5sum
will display something like
96.5MB 0:00:05 [25.3MB/s] [=======> ] 9% ETA 0:00:48
Read the rest of this entry »
4 Comments |
Linux, Shell, Technology | Tagged: bzip, bzip2, compression, decompression, md5, md5 sum, md5sum, pipe, progress, progress bar, pv, tar, throughput, tool, trick, unzip, zip |
Permalink
Posted by Constantin
June 14, 2008
Recently I got my hands on a DVD which I couldn’t get to mount. The message that appeared consistently in dmesg was:
UDF-fs: No fileset found
Searching the forums I found out that this is a widespread problem. Vista uses some kind of non-standard UDF which only Windows can read. I was very tempted to run to the Windows PC in the other room and let it eat the disc, but I was curious if there was any other solution.
Many suggested mounting manually with -t udf, but that didn’t work. Another suggestion was patching and recompiling the kernel. I was obviously NOT in the mood to do that. Digging a bit deeper I found that there is actually a less greasy solution. The two relevant links are one and two. I will describe now the exact procedure I used to get my Linux box to recognize the Vista-burnt DVD. Note that, because of the rapidly changing environment, this will probably NOT work on anything OTHER than *Ubuntu Hardy with kernel version 2.6.24.
Read the rest of this entry »
30 Comments |
Learning, Linux, Programming, Random, Shell, Technology | Tagged: cli, console, dvd, dvd-r, dvd-rw, fileset, how to, howto, kernel, module, patch, standard, tutorial, ubuntu, udf, vista, windows |
Permalink
Posted by Constantin
May 27, 2008
Before I began using VIM I didn’t care much that my typing habits were very inefficient, but now I’m looking everywhere for possible optimizations 
There are two simple shortcuts that work on KDE, Gnome and (AFAIK) even Windows, and that will probably become second nature once you start using them. Perhaps they are regarded as common knowledge, but I’ve only stumbled across them this year.
Ctrl+Backspace deletes the last word.
Ctrl+Delete deletes the next word.
And of course Ctrl+W in bash (as in VIM) is very useful when the length of your command gets out of control.
2 Comments |
Learning, Linux, Random, Shell, Shortcut | Tagged: efficiency, habit, keyboard, optimization, short, speed, tip, typing |
Permalink
Posted by Constantin
April 3, 2008
Daylight Saving Time is a controversial policy, but if you live in a region where it’s used, there’s not much you can do about it.
Linux adjusts the clock automatically, using zoneinfo. You can find out when these changes happened / are scheduled to happen using the zdump tool:
zdump -v Europe/Chisinau
The argument should be a path relative to /usr/share/zoneinfo/. A quick hint that you got it wrong is if you only get four entries (for the limits of time ;) ), 1901 and 2038 here, for instance.
P.S. If you have other operating systems on your machine, you should only allow one of them to change the time, otherwise you’ll get your clock shifted by more than one hour.
3 Comments |
Linux, Shell | Tagged: dst, summer time, time, time zones, zoneinfo |
Permalink
Posted by Constantin
February 17, 2008
I had a PDF file which I wanted to print with multiple pages per sheet. But the margins were so big that a lot of paper would have gone to waste.
I couldn’t just select the text, copy it and format it to my liking. The file is not scanned, so it’s still a mystery to me why the extracted text turns out garbled.
The solution I found was the pdfrescale script (via here). It uses some kind of latex magic to scale the entire PDF by whatever factor you want. All the needed dependencies should by installed by
sudo aptitude install pdftk pdfjam
If you know of an easier solution, I’d be interested to hear about it!

4 Comments |
Linux, Random, Shell | Tagged: latex, margin, margins, pdf, pdfrescale, print, printing, rescale, scale, screenshot, script, trick |
Permalink
Posted by Constantin
January 2, 2008
Linux does a great job of checking the local file systems every once in a while to make sure there is no corruption. Unfortunately, this luxury does not extend to removable drives. It will give you a warning (file system unchecked for so many days), but will do nothing about it. That is why I recommend doing a manual check on your external drives from time to time.
If you run fsck with the default options, it will not display any indication of progress, and that can get annoying if you have a large drive and don’t know how much longer you’ll have to wait. But there is a simple solution to this, I only wish I had taken the time to read the man page earlier:
fsck -C /dev/sda5
that will display a nice progress indicator while scanning (works only for ext2/ext3).
4 Comments |
Linux, Shell | Tagged: fsck, progress, tip |
Permalink
Posted by Constantin