<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2257094104851086843</id><updated>2024-12-23T06:38:45.929+11:00</updated><category term="All Linux"/><category term="zsh"/><category term="Ubuntu"/><category term="bash"/><category term="vim"/><category term="kde"/><category term="compiz"/><category term="git"/><category term="less"/><title type='text'>Manki’s Linux Tips</title><subtitle type='html'>Some tiny nifty ways I have configured my Ubuntu machine to improve my productivity.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>36</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-516805196763635597</id><published>2022-06-24T03:22:00.000+10:00</published><updated>2022-06-24T03:22:01.614+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><title type='text'>Using Compose Sequences when your keyboard doesn’t have a Pause key</title><content type='html'>&lt;p&gt;One of the things I love about using a Linux machine is that I can &lt;a href=&quot;https://cgit.freedesktop.org/xorg/lib/libX11/plain/nls/en_US.UTF-8/Compose.pre&quot;&gt;enter special characters&lt;/a&gt; easily using &lt;a href=&quot;https://help.ubuntu.com/community/ComposeKey&quot;&gt;Compose Sequences&lt;/a&gt;. I use the &lt;kbd&gt;Pause&lt;/kbd&gt; key as the “multi-key” since that key isn’t used for anything else. It was all great when I was using a desktop machines with full-size keyboards. Now I am using a laptop most of the time, and laptops don’t usually have “useless” keys such as the &lt;kbd&gt;Pause&lt;/kbd&gt; key.&lt;/p&gt;&lt;p&gt;With a bit of Googling, I learnt that &lt;b&gt;pressing &lt;kbd&gt;Fn+p&lt;/kbd&gt; on Lenovo laptops is equivalent to pressing the dedicated &lt;kbd&gt;Pause&lt;/kbd&gt; key&lt;/b&gt;. This is my today’s happy discovery. 🙂&lt;/p&gt;&lt;p&gt;By the way, if most of your work is done in the Chrome browser, and you can’t (or don’t want to) use Compose sequences, you may try the &lt;a href=&quot;https://chrome.google.com/webstore/detail/paste-from-context-menu/ihfogeehoikadinpdoeapemeolcppfjf&quot;&gt;Paste From Context Menu&lt;/a&gt; extension. This extension saved me a ton of time when I was using Chrome OS devices.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEia4z1WAPITmBq-4xXicymvdHogW6gqTGJ_JX63P2YBGONuSsp5Dla88v16FQSNXPDT1ABi5-WglN3nfcu4SzmBn0D6kC8L4On93E67TbNUvQmAm2wPsGU1TM5syViS2XeXNVx-dl25fb6AsZ3qUkCqE5U49rgX4cY9GuyP2LUwYrl1_VSTGkoNZbTVew&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Screenshot of the &#39;Paste From Context Menu&#39; Chrome extension in action&quot; data-original-height=&quot;538&quot; data-original-width=&quot;651&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEia4z1WAPITmBq-4xXicymvdHogW6gqTGJ_JX63P2YBGONuSsp5Dla88v16FQSNXPDT1ABi5-WglN3nfcu4SzmBn0D6kC8L4On93E67TbNUvQmAm2wPsGU1TM5syViS2XeXNVx-dl25fb6AsZ3qUkCqE5U49rgX4cY9GuyP2LUwYrl1_VSTGkoNZbTVew&quot; width=&quot;290&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/516805196763635597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2022/06/compose-sequences-without-hardware-pause-key.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/516805196763635597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/516805196763635597'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2022/06/compose-sequences-without-hardware-pause-key.html' title='Using Compose Sequences when your keyboard doesn’t have a Pause key'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEia4z1WAPITmBq-4xXicymvdHogW6gqTGJ_JX63P2YBGONuSsp5Dla88v16FQSNXPDT1ABi5-WglN3nfcu4SzmBn0D6kC8L4On93E67TbNUvQmAm2wPsGU1TM5syViS2XeXNVx-dl25fb6AsZ3qUkCqE5U49rgX4cY9GuyP2LUwYrl1_VSTGkoNZbTVew=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-9074692692894217698</id><published>2022-06-19T22:52:00.000+10:00</published><updated>2022-06-19T22:52:07.527+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><title type='text'>Inputting Rupee symbol (₹) on Linux machines</title><content type='html'>&lt;p&gt;&lt;b&gt;tl;dr&lt;/b&gt;: When using an &lt;a href=&quot;https://en.wikipedia.org/wiki/InScript_keyboard&quot;&gt;InScript keyboard layout&lt;/a&gt;, press &lt;kbd&gt;right Alt + 4&lt;/kbd&gt; to enter the rupee symbol.&lt;/p&gt;&lt;p&gt;One of the things that I couldn’t figure out for a very long time is how to easily enter the Indian Rupee sign (₹) while entering text. When I was using a Linux machine primarily, I managed by simply copy-pasting the symbol whenever I needed it. After using Chrome OS for a few years, I had gotten used to entering the rupee sign without much fuss, and I missed that ease once I returned to a Linux machine.&lt;/p&gt;&lt;p&gt;I started looking around to see how I can modify keyboard layouts to easily enter the rupee sign. To my surprise, all InScript keyboard layouts had this line:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;include &quot;rupeesign(4)&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;Looking around, I found a &lt;code&gt;/usr/share/X11/xkb/symbols/rupeesign&lt;/code&gt;. This file had this config:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;xkb_symbols &quot;4&quot; {
    key &amp;lt;AE04&amp;gt;	{ [  NoSymbol,   NoSymbol,   U20B9 ]	};
};&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;A quick Google search confirmed that U+20B9 was indeed the rupee sign. Basically, everything needed to easily input the rupee sign is there; only I didn’t know how to use this.&lt;/p&gt;&lt;p&gt;The &lt;code&gt;level3&lt;/code&gt; file in the same directory had the clue. This file started with this comment:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;// The default behaviour:
// the right Alt key (AltGr) chooses the third symbol engraved on a key.&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;As soon as I saw the mention of &lt;kbd&gt;right Alt&lt;/kbd&gt; as the modifier to use, it became clear that &lt;kbd&gt;right Alt + 4&lt;/kbd&gt; was all I needed.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/9074692692894217698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2022/06/inputting-rupee-symbol-on-linux-machines.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/9074692692894217698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/9074692692894217698'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2022/06/inputting-rupee-symbol-on-linux-machines.html' title='Inputting Rupee symbol (₹) on Linux machines'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-9059131557603630475</id><published>2016-04-05T15:19:00.001+10:00</published><updated>2016-04-05T15:19:12.194+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><title type='text'>Ubuntu on Lenovo P50: using NVidia proprietary drivers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I managed to dual boot Ubuntu (Kubuntu 14.04, actually) on my shiny new Lenovo P50. With the default Nouveau driver, the experience left a lot to be desired. Graphics performance was slow and suspend-resume worked only once. For every boot, suspend will work once. After that, suspending will do nothing—the machine will just stay on forever.&lt;br /&gt;
&lt;br /&gt;
I followed the prompts to install the proprietary drivers, which didn’t really help. After installing the drivers, X would simply not start. So I had to revert to the open source&amp;nbsp;Nouveau driver. (You’d do this by getting a root shell from recovery boot and purging all Nvidia packages.)&lt;br /&gt;
&lt;br /&gt;
Today, as a wild guess, I decided to install the proprietary driver and disable the Intel GPU altogether. (You’d do this by choosing Discrete Only option in BIOS display settings. The default is Hybrid, which keeps both Intel and NVidia GPUs active.) Maybe that could help, I thought, and to my surprise it did work. Graphics is now fast, and suspend-resume works too. Initial display of LightDM and logging into KDE are a bit slow, but everything else is nice and snappy.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/9059131557603630475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2016/04/ubuntu-on-lenovo-p50-using-nvidia.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/9059131557603630475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/9059131557603630475'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2016/04/ubuntu-on-lenovo-p50-using-nvidia.html' title='Ubuntu on Lenovo P50: using NVidia proprietary drivers'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-4393679238480280118</id><published>2013-06-11T13:29:00.001+10:00</published><updated>2013-06-11T14:22:45.963+10:00</updated><title type='text'>Watch Apple WWDC keynote video in Linux</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Make your browser lie to apple.com that you’re using a Windows machine. I made my Chrome to use the UserAgent string of Firefox on Windows. The video player loaded. Ubuntu seems to have a QuickTime plugin installed, so the video just played.&lt;br /&gt;
&lt;br /&gt;
To change UserAgent of Chrome (i.e. to make Chrome pretend it’s Firefox running on Windows), open &lt;i&gt;Menu &amp;gt; Tools &amp;gt; Developer Tools&lt;/i&gt;. Click on the Gear icon at the bottom-right corner and select UserAgent checkbox.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigbb16pU0XMa1RwdqETwWfH87XFyfUk1GVFkkg2vgO_R8Que-oCGAFfY3UwELkZkyl7Yp9q-EnCH-KM30AdcTzwIAwBQxr48VXmomAKq_GHflx31_JFjckxN3ubIYAk5rDvP0Y3W2UR-vG/s1600/user-agent.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;178&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigbb16pU0XMa1RwdqETwWfH87XFyfUk1GVFkkg2vgO_R8Que-oCGAFfY3UwELkZkyl7Yp9q-EnCH-KM30AdcTzwIAwBQxr48VXmomAKq_GHflx31_JFjckxN3ubIYAk5rDvP0Y3W2UR-vG/s530/user-agent.png&quot; width=&quot;530&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/4393679238480280118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2013/06/watch-apple-wwdc-keynote-video-in-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/4393679238480280118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/4393679238480280118'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2013/06/watch-apple-wwdc-keynote-video-in-linux.html' title='Watch Apple WWDC keynote video in Linux'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigbb16pU0XMa1RwdqETwWfH87XFyfUk1GVFkkg2vgO_R8Que-oCGAFfY3UwELkZkyl7Yp9q-EnCH-KM30AdcTzwIAwBQxr48VXmomAKq_GHflx31_JFjckxN3ubIYAk5rDvP0Y3W2UR-vG/s72-c/user-agent.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-8159373404205318696</id><published>2012-10-21T22:54:00.000+11:00</published><updated>2012-10-21T22:54:22.623+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="kde"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Seeing GTK mouse cursor in KDE?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;If you have upgraded to Kubuntu 12.10, you’d notice that &lt;a href=&quot;http://en.wikipedia.org/wiki/KDE_Display_Manager&quot;&gt;KDM&lt;/a&gt; has been replaced with &lt;a href=&quot;http://en.wikipedia.org/wiki/LightDM&quot;&gt;LightDM&lt;/a&gt;. &amp;nbsp;LightDM looks pretty, but somehow doesn’t play well with KDE. &amp;nbsp;One annoying issue I have noticed is that GTK applications run in KDE use GTK mouse cursor under certain circumstances. &amp;nbsp;When Chrome shows a menu, the mouse cursor changes to a GTK one and it looks jarring. &amp;nbsp;Turns out, there’s a fix for that.&lt;br /&gt;
&lt;br /&gt;
1. Install LightDM KDE greeter&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;sudo apt-get install&amp;nbsp;lightdm-kde-greeter&lt;/code&gt;&lt;/pre&gt;2. Make LightDM use KDE greeter, and all will be well again. To do that, edit the file &lt;code&gt;/etc/lightdm/lightdm.conf&lt;/code&gt; and change the value of &lt;code&gt;greeter-session&lt;/code&gt;. &amp;nbsp;The file will look something like this after the change. &amp;nbsp;(Boldface text is the change you’d have to make.)&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;[SeatDefaults]
greeter-session=&lt;b&gt;lightdm-kde-greeter&lt;/b&gt;
user-session=ubuntu&lt;/code&gt;&lt;/pre&gt;3. Save the file and test your changes by running LightDM in test mode:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;lightdm --test-mode&lt;/code&gt;&lt;/pre&gt;If LightDM doesn’t open correctly, check if you have made any typing errors in the config file. &amp;nbsp;If you cannot fix the issue, just restore the file as it was before you edited; you’ll still have the ugly mouse cursor issue, but at least your computer will continue to work.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/8159373404205318696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/10/seeing-gtk-mouse-cursor-in-kde.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8159373404205318696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8159373404205318696'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/10/seeing-gtk-mouse-cursor-in-kde.html' title='Seeing GTK mouse cursor in KDE?'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-2801321870644113816</id><published>2012-10-07T20:58:00.000+11:00</published><updated>2012-10-08T12:53:50.284+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>Map Windows (aka Super) key to Escape</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Did you know I have mapped Caps Lock on my computer to &lt;a href=&quot;http://linuxtips.manki.in/2011/10/opening-new-browser-tab-when-caps-lock.html&quot;&gt;open a new browser tab&lt;/a&gt;? &amp;nbsp;Only today I figured my Vim sessions can be a lot better if I mapped ‘Windows’ key (aka Super key) to Escape. &amp;nbsp;It can be done by adding a single line to your &lt;code&gt;~/.Xmodmap&lt;/code&gt; file:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;! Map left Windows key to Escape.
keysym Super_L = Escape&lt;/code&gt;&lt;/pre&gt;
(Okay, that was &lt;em&gt;two&lt;/em&gt; lines, but a little comment in obscure configuration files can be very helpful.)&lt;br /&gt;
&lt;br /&gt;
Also, if you don’t feel like logging out and logging back in after these changes (or if you want to try the change before touching your config file), you can run this on a terminal to have the keybinding take effect immediately:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;xmodmap -e &#39;keysym Super_L = Escape&#39;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/2801321870644113816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/10/map-windows-aka-super-key-to-escape.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/2801321870644113816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/2801321870644113816'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/10/map-windows-aka-super-key-to-escape.html' title='Map Windows (aka Super) key to Escape'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-8773368480276446999</id><published>2012-09-11T11:40:00.000+10:00</published><updated>2012-09-11T11:40:23.626+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="kde"/><title type='text'>Prettier fonts in KDE</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
If you’re a KDE user and have always envied Gnome for its font rendering (especially with fonts like Ubuntu and Ubuntu Mono), read on.&lt;br /&gt;
&lt;br /&gt;
All you need to do is select ‘Enabled’ for &lt;i&gt;System Settings &amp;gt; Application Appearance &amp;gt; Fonts &amp;gt; Use anti-aliasing&lt;/i&gt;. &amp;nbsp;Click on the &lt;i&gt;Configure&lt;/i&gt; button and set &lt;i&gt;Hinting style&lt;/i&gt; to ‘Slight’. &amp;nbsp;If you like &lt;a href=&quot;http://en.wikipedia.org/wiki/ClearType&quot;&gt;ClearType&lt;/a&gt; style font rendering, enable subpixel rendering too.&lt;br /&gt;
&lt;br /&gt;
Any program that’s opened after this change will use the new font rendering settings. &amp;nbsp;So you may want to restart your open apps or logout and log back in.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/8773368480276446999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/09/prettier-fonts-in-kde.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8773368480276446999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8773368480276446999'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/09/prettier-fonts-in-kde.html' title='Prettier fonts in KDE'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-3663880741029228457</id><published>2012-09-08T11:56:00.001+10:00</published><updated>2012-09-08T11:56:59.108+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Disabling Ubuntu menu proxy when not using Unity</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Does seeing messages like this on your terminal annoy you?&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;** (gvim:8016): WARNING **: Unable to create Ubuntu Menu Proxy: Timeout was reached&lt;/code&gt;&lt;/pre&gt;
It sure does annoy me. &amp;nbsp;Turns out, it’s because the app you’re running is trying to connect its menus to Unity’s “global menu” (or whatever that’s called). &amp;nbsp;The way to fix this problem would be to disable Unity menu proxy when you’re not using Unity. &amp;nbsp;Add this to your shell’s startup script (&lt;code&gt;.bashrc&lt;/code&gt;, &lt;code&gt;.zshrc&lt;/code&gt;, etc):&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;if [[ $DESKTOP_SESSION != &quot;ubuntu&quot; &amp;amp;&amp;amp; $DESKTOP_SESSION != &quot;ubuntu-2d&quot; ]]
then
  export UBUNTU_MENUPROXY=0
fi&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/3663880741029228457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/09/disabling-ubuntu-menu-proxy-when-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/3663880741029228457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/3663880741029228457'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/09/disabling-ubuntu-menu-proxy-when-not.html' title='Disabling Ubuntu menu proxy when not using Unity'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-6518926713044525662</id><published>2012-08-31T16:30:00.000+10:00</published><updated>2012-08-31T16:30:07.901+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="zsh"/><title type='text'>My zsh prompt string PS1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Every Unix user with a blog has a post about it: how they have configured their &lt;a href=&quot;http://en.wikipedia.org/wiki/Command-line_interface#Command_prompt&quot;&gt;PS1&lt;/a&gt; so their command prompt is almost a mini dashboard that shows everything they’d need to know. &amp;nbsp;I am no exception. &amp;nbsp;Even if this post doesn’t really help others, bragging is gratifying, so I’d go on and show how awesome my PS1 is :)&lt;br /&gt;
&lt;br /&gt;
I have been using &lt;a href=&quot;http://www.zsh.org/&quot;&gt;zsh&lt;/a&gt; for a while now, and I am quite happy with it. &amp;nbsp;I’m a &lt;a href=&quot;http://linuxtips.manki.in/2011/10/zsh-syntax-highlighting.html&quot;&gt;sucker for colours&lt;/a&gt; and I was annoyed that I couldn’t take full advantage of my 256 colour terminal because I just didn’t know how to. &amp;nbsp;So I searched the web and found &lt;a href=&quot;http://lucentbeing.com/blog/that-256-color-thing/&quot;&gt;two&lt;/a&gt; &lt;a href=&quot;http://www.pixelbeat.org/docs/terminal_colours/&quot;&gt;good&lt;/a&gt; pages. &amp;nbsp;Combined with some manual-reading I had done, I cooked up my shiny new PS1:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;PS1=&#39;%(?.%F{245}.%F{124})%2m %F{130}%~ %F{215}%# %f&#39;&lt;/code&gt;&lt;/pre&gt;
Unfortunately, prompt strings are never intuitive, so I’ll do some explaining.&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;code&gt;%F{&lt;i&gt;colour_code&lt;/i&gt;}&lt;/code&gt; sets the foreground colour to the specified colour. &amp;nbsp;Colour code is simply a number in the range 0 to 255 (assuming your terminal supports 256 colours).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;%f&lt;/code&gt; resets the foreground colour to default.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;%(&lt;i&gt;condn&lt;/i&gt;.&lt;i&gt;true_string&lt;/i&gt;.&lt;i&gt;false_string&lt;/i&gt;)&lt;/code&gt; is a conditional expression. &amp;nbsp;If &lt;code&gt;&lt;i&gt;condn&lt;/i&gt;&lt;/code&gt; evaluates to &lt;code&gt;true&lt;/code&gt;, &lt;code&gt;&lt;i&gt;true_string&lt;/i&gt;&lt;/code&gt; is emitted; otherwise &lt;code&gt;&lt;i&gt;false_string&lt;/i&gt;&lt;/code&gt; is emitted. &amp;nbsp;Like you’d expect, you can have some special strings in&amp;nbsp;&lt;code&gt;&lt;i&gt;condn&lt;/i&gt;&lt;/code&gt;&amp;nbsp;to mean interesting things.&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Deconstructing my PS1&lt;/b&gt;&lt;br /&gt;
I actually started with something more simple:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;PS1=&#39;%F{245}%2m %F{130}%~ %F{215}%# %f&#39;&lt;/code&gt;&lt;/pre&gt;
The prompt string starts with the machine name printed in grey. &amp;nbsp;Then comes the current working directory in a yellow/orange colour, followed by zsh’s % prompt that’s a wee bit brighter than the directory name. &amp;nbsp;But I wanted to have the exit status of the previous command in my prompt somewhere. &amp;nbsp;It’s not some information I really need, but I thought it can be a nice-to-have. &amp;nbsp;But at the same time I didn’t want this information to clutter up my prompt.&lt;br /&gt;
&lt;br /&gt;
I figured I could use make use of colours to differentiate between success and failure of the previous command. &amp;nbsp;So I changed &lt;code&gt;%F{245}%2m&lt;/code&gt; to &lt;code&gt;%(?.%F{245}.%F{124})%2m&lt;/code&gt;. &amp;nbsp;Now, the machine name is printed in grey if the previous command succeeded, and in red if it had failed. &amp;nbsp;Thus born the prompt string that exactly fits my needs... for now.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/6518926713044525662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/08/my-zsh-prompt-string-ps1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/6518926713044525662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/6518926713044525662'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/08/my-zsh-prompt-string-ps1.html' title='My zsh prompt string &lt;code&gt;PS1&lt;/code&gt;'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-6418118005666379622</id><published>2012-08-10T13:31:00.002+10:00</published><updated>2012-08-10T13:59:43.637+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><category scheme="http://www.blogger.com/atom/ns#" term="zsh"/><title type='text'>Only 8 colours on ssh-ed terminals?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Vim (i.e. &lt;i&gt;console&lt;/i&gt; &lt;code&gt;vim&lt;/code&gt;, but not &lt;code&gt;gvim&lt;/code&gt;) on my primary workstation uses 256 colours and with syntax highlighting on, editing source code is a much pleasant experience (vs. being limited to 8 colours).&lt;br /&gt;
&lt;br /&gt;
However, every time I ssh a different machine, Vim on the remote machine always used 8 colours. &amp;nbsp;I’m a big fan of seeing a lot of colours and hated the 8-colours environment of the remote machines. &amp;nbsp;After some digging, I found out the cause for this problem. &amp;nbsp;My primary machine has&amp;nbsp;&lt;code&gt;COLORFGBG&lt;/code&gt; environment variable set, but the remote machines don’t. &amp;nbsp;Check&amp;nbsp;&lt;a href=&quot;http://www.sslug.dk/~chlor/vim-set-background-auto.html&quot;&gt;Skåne Sjælland Linux User Group&lt;/a&gt; to see how you can fix this issue. &amp;nbsp;(Essentially, you’ll have to configure ssh on your machine and the remote machine to pass &lt;code&gt;COLORFGBG&lt;/code&gt; environment variable.)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update&lt;/b&gt;: Actually, adding the line &lt;code&gt;set background=dark&lt;/code&gt; to my &lt;code&gt;~/.vimrc&lt;/code&gt; seems like a much easier solution. &amp;nbsp;And also, “only 8 colours” is not the real problem. &amp;nbsp;Real problem is that vim is using a different set of colours (dark blue instead of light blue, for instance) on the new machine.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/6418118005666379622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/08/only-8-colours-on-ssh-ed-terminals.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/6418118005666379622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/6418118005666379622'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/08/only-8-colours-on-ssh-ed-terminals.html' title='Only 8 colours on ssh-ed terminals?'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-5762693173010214201</id><published>2012-06-13T07:38:00.000+10:00</published><updated>2012-06-13T07:38:10.625+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="zsh"/><title type='text'>Renaming files using pattern matching</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Let’s say you have a bunch of files in a directory with names like &lt;code&gt;dog.jpeg&lt;/code&gt;, &lt;code&gt;cat.jpeg&lt;/code&gt;, &lt;code&gt;fountain.jpeg&lt;/code&gt;, etc. &amp;nbsp;Your OCD insists that you rename them all to more “regular” names like &lt;code&gt;dog.jpg&lt;/code&gt;, &lt;code&gt;cat.jpg&lt;/code&gt;, and &lt;code&gt;fountain.jpg&lt;/code&gt;. &amp;nbsp;If you use &lt;code&gt;zsh&lt;/code&gt;, pat yourself on the back for using a cool shell, and run these commands:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;autoload zmv
zmv -W &#39;*.jpeg&#39; &#39;*.jpg&#39;&lt;/code&gt;&lt;/pre&gt;
You probably know this already, but it’s worth mentioning. &amp;nbsp;Single quotes around the patterns is important because we want &lt;code&gt;zmv&lt;/code&gt; to interpret the pattern; &lt;code&gt;zsh&lt;/code&gt; should pass the pattern as such to &lt;code&gt;zmv&lt;/code&gt; without expanding it.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/5762693173010214201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/06/renaming-files-using-pattern-matching.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/5762693173010214201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/5762693173010214201'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/06/renaming-files-using-pattern-matching.html' title='Renaming files using pattern matching'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-2066839455963635131</id><published>2012-05-23T22:04:00.001+10:00</published><updated>2012-05-23T22:04:39.057+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="kde"/><title type='text'>Directly switch to the window that’s showing a popup</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
If a window that’s not currently active shows a dialogue box, KDE would highlight it in the taskbar. &amp;nbsp;Switching to that window is a lot easier than hunting it down by pressing &lt;kbd&gt;Alt+Tab&lt;/kbd&gt; repeatedly. &amp;nbsp;Just press &lt;kbd&gt;Ctrl+Alt+A&lt;/kbd&gt;, and voila, you’re looking at the window that’s asking for your attention.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/2066839455963635131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/05/directly-switch-to-window-thats-showing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/2066839455963635131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/2066839455963635131'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/05/directly-switch-to-window-thats-showing.html' title='Directly switch to the window that’s showing a popup'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-7957630459925897264</id><published>2012-04-29T21:28:00.000+10:00</published><updated>2012-04-29T21:28:19.795+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="kde"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Auto-deleting files from Trash and trash-cli package</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Two tips about using Trash (aka Recycle Bin) folder efficiently on KDE:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;You can configure &lt;a href=&quot;http://dolphin.kde.org/&quot;&gt;Dolphin&lt;/a&gt; to automatically delete files from Trash that are older than a certain number of days. &amp;nbsp;Use &lt;i&gt;Dolphin menu &amp;gt; Configure Dolphin... &amp;gt; Trash &amp;gt; Delete files older than&lt;/i&gt; setting.&lt;/li&gt;
&lt;li&gt;You can access your Trash from command line if you have &lt;code&gt;trash-cli&lt;/code&gt; package installed. &amp;nbsp;(Install it by running &lt;code&gt;sudo apt-get install trash-cli&lt;/code&gt; command.) &amp;nbsp;Once installed, &lt;code&gt;trash-list&lt;/code&gt; command shows the contents of your Trash, &lt;code&gt;trash-put&lt;/code&gt; command moves files to Trash, and &lt;code&gt;trash-empty&lt;/code&gt; command permanently deletes everything in Trash.&lt;/li&gt;
&lt;/ol&gt;
&lt;small&gt;Source: A &lt;a href=&quot;http://stefaanlippens.net/totrash#comment-3013&quot;&gt;comment&lt;/a&gt; on Stefaan Lippens’ webface.&lt;/small&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/7957630459925897264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/04/auto-deleting-files-from-trash-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/7957630459925897264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/7957630459925897264'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/04/auto-deleting-files-from-trash-and.html' title='Auto-deleting files from Trash and &lt;code&gt;trash-cli&lt;/code&gt; package'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-1820563962879986351</id><published>2012-02-25T03:05:00.000+11:00</published><updated>2012-03-13T21:26:19.201+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="git"/><category scheme="http://www.blogger.com/atom/ns#" term="less"/><title type='text'>Making git commands clear screen when they exit</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
One thing I don’t like about &lt;a href=&quot;http://git-scm.com/&quot;&gt;&lt;code&gt;git&lt;/code&gt;&lt;/a&gt; is that commands like &lt;code&gt;git diff&lt;/code&gt; don’t clear screen when they exit. &amp;nbsp;If I view a file using &lt;code&gt;less&lt;/code&gt;, e.g. by running &lt;code&gt;less ~/.zshrc&lt;/code&gt;, &lt;code&gt;less&lt;/code&gt; would clear the file content from the screen when it exits. &amp;nbsp;But &lt;code&gt;git diff&lt;/code&gt;, &lt;code&gt;git log&lt;/code&gt;, etc. don’t. &amp;nbsp;With some Googling around, I found that:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;git&lt;/code&gt; uses the default pager the user has configured. &amp;nbsp;On Ubuntu machines it’s &lt;code&gt;less&lt;/code&gt; when &lt;code&gt;$PAGER&lt;/code&gt; is not defined.&lt;/li&gt;
&lt;li&gt;You can configure less by defining &lt;code&gt;$LESS&lt;/code&gt; variable with the flags you want to pass by default.&lt;/li&gt;
&lt;li&gt;Nigel McNie has posted a set of flags that are a &lt;a href=&quot;http://nigel.mcnie.name/blog/git-pager-why-are-git-commands-always-shown-in-less-now&quot;&gt;good default flags&lt;/a&gt; for &lt;code&gt;less&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-X&lt;/code&gt; option to &lt;code&gt;less&lt;/code&gt; tells it to &lt;em&gt;not&lt;/em&gt; clear the screen when it exits. &amp;nbsp;From a &lt;a href=&quot;http://superuser.com/questions/304538/less-doesnt-clear-screen-after-quit&quot;&gt;related question on Super User&lt;/a&gt; I found that passing the flag &lt;code&gt;-+X&lt;/code&gt; would force &lt;code&gt;less&lt;/code&gt; to always clear the screen when it exits.&lt;/li&gt;
&lt;/ul&gt;
&lt;strike&gt;Combining all these together, I have added this to my &lt;code&gt;~/.zshrc&lt;/code&gt;, and everything is just the way I want.&lt;/strike&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&lt;strike&gt;export LESS=&quot;-+X -FR&quot;&lt;/strike&gt;&lt;/code&gt;&lt;/pre&gt;
While adding this line made &lt;code&gt;git&lt;/code&gt; work fine, it resulted in &lt;code&gt;less&lt;/code&gt; behaving erratically. &amp;nbsp;Now I have the following config in my &lt;code&gt;~/.gitconfig&lt;/code&gt;, and things seem to be good.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;[core]
&amp;nbsp; pager = less -+X -+F&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/1820563962879986351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/02/making-git-commands-clear-screen-when.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/1820563962879986351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/1820563962879986351'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/02/making-git-commands-clear-screen-when.html' title='Making git commands clear screen when they exit'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-7287491080477569588</id><published>2012-01-18T11:53:00.001+11:00</published><updated>2012-01-18T11:53:25.196+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="zsh"/><title type='text'>Inserting single quote character inside a single-quoted string</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
“Strings” (not the same as strings in languages like C or Python) in shells (&lt;code&gt;bash&lt;/code&gt; and &lt;code&gt;zsh&lt;/code&gt; especially) can be enclosed within either single quotes (&lt;code&gt;&#39;&lt;/code&gt;) or double quotes (&lt;code&gt;&quot;&lt;/code&gt;). &amp;nbsp;Double quotes escape (i.e. remove special meaning from) characters like space and single quotes, but single quotes remove meaning from almost every special character including spaces, &lt;code&gt;$&lt;/code&gt;, &lt;code&gt;!&lt;/code&gt;, new lines, etc. &amp;nbsp;(&lt;a href=&quot;http://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash&quot;&gt;Learn more&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
You can use &lt;code&gt;\&lt;/code&gt; escape to insert a double quote character (&lt;code&gt;&quot;&lt;/code&gt;) inside a double-quoted string, but you cannot do the same for inserting a single quote character (&lt;code&gt;&#39;&lt;/code&gt;) inside a single-quoted string. &amp;nbsp;Because &lt;code&gt;\&lt;/code&gt; has no special meaning inside a single-quoted string.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% echo &quot;abc \&quot; def&quot;
abc &quot; def
% echo &#39;abc \&#39; def&#39;                   
quote&amp;gt; blah&#39;
abc \ def
blah
%&lt;/code&gt;&lt;/pre&gt;
But I often find myself needing to insert apostrophes inside single-quoted strings. &amp;nbsp;I use the following syntax then:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% echo &#39;There&#39;\&#39;&#39;s always a way out&#39;
There&#39;s always a way out&lt;/code&gt;&lt;/pre&gt;
Shells usually let you concatenate strings by just writing them together without any space between them: &lt;code&gt;&quot;abc&quot;&quot;def&quot;&lt;/code&gt; is the same as &lt;code&gt;&quot;abcdef&quot;&lt;/code&gt;&amp;nbsp;which is the same as &lt;code&gt;&quot;abc&quot;&#39;def&#39;&lt;/code&gt; which is the same as&amp;nbsp;&lt;code&gt;abcdef&lt;/code&gt; (without quotes). &amp;nbsp;We use the same technique here: we have two different single-quoted strings: &lt;code&gt;&#39;There&#39;&lt;/code&gt; and &lt;code&gt;&#39;s always a way out&#39;&lt;/code&gt;. &amp;nbsp;In between them we have a single-quote character escaped with &lt;code&gt;\&lt;/code&gt; to mean that we want a literal apostrophe character inserted.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/7287491080477569588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/01/inserting-single-quote-character-inside.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/7287491080477569588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/7287491080477569588'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/01/inserting-single-quote-character-inside.html' title='Inserting single quote character inside a single-quoted string'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-3224446769446154274</id><published>2012-01-14T14:52:00.000+11:00</published><updated>2012-05-01T22:15:08.454+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Running Ubuntu on a Toshiba Z830</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I bought a&amp;nbsp;&lt;a href=&quot;http://www.mytoshiba.com.au/products/computers/satellite/z830/pt22la-001001&quot;&gt;Toshiba Z830&lt;/a&gt;&amp;nbsp;recently. &amp;nbsp;This post is to document how I am running Kubuntu on it. &amp;nbsp;First, let me show you how fast it boots :)&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/KufEMtfDCTE&quot; width=&quot;560&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;The machine has only 128GB storage, which &lt;a href=&quot;http://blog.manki.in/2011/12/you-cannot-upgrade-toshiba-z830s-ssd.html&quot;&gt;cannot be upgraded yet&lt;/a&gt;, which means having both Windows and Linux on the machine may not be realistic. &amp;nbsp;But there’s a way to &lt;b&gt;back up Windows&lt;/b&gt;! &amp;nbsp;Toshiba bundles a program with the computer that creates &lt;a href=&quot;http://en.wikipedia.org/wiki/Recovery_disc&quot;&gt;recovery USB drives&lt;/a&gt; for the Z830. &amp;nbsp;I bought a new 16GB USB drive and made it a recovery drive. &amp;nbsp;The plan is to use this for restoring Windows when I am giving this laptop away to somebody in future.&lt;/li&gt;
&lt;li&gt;I downloaded 64-bit Kubuntu 11.10 installer from &lt;a href=&quot;http://www.kubuntu.org/getkubuntu/download&quot;&gt;kubuntu.org&lt;/a&gt;. &amp;nbsp;Since I have a backup copy of Windows, I &lt;b&gt;removed all NTFS and recovery partitions&lt;/b&gt; from the disk and &lt;a href=&quot;http://linuxtips.manki.in/2012/01/partitioning-disk-for-installing-linux.html&quot;&gt;created new partitions&lt;/a&gt;&amp;nbsp;for installing Kubuntu.&lt;/li&gt;
&lt;li&gt;After the installation, &lt;b&gt;almost everything worked out of the box&lt;/b&gt;. &amp;nbsp;I had no issues with the laptop sleeping or waking up; 3D graphics worked fine; audio, bluetooth, webcam... everything worked. &amp;nbsp;Except the following one issue.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Screen brightness&lt;/b&gt; controls sometimes worked, but sometimes they didn’t. &amp;nbsp;The &lt;a href=&quot;http://blog.manki.in/2008/01/more-linux-fun-screen-brightness.html&quot;&gt;technique that helped in 2008&lt;/a&gt; helped me this time too, except I needed to make a minor modification to the program: the file that required changing was &lt;code&gt;/sys/class/backlight/intel_backlight/brightness&lt;/code&gt; (i.e. &lt;code&gt;intel_backlight&lt;/code&gt; instead of &lt;code&gt;acpi_video0&lt;/code&gt;). &amp;nbsp;And the brightness value seem to be in the range of 100 through 4400.&lt;/li&gt;
&lt;li&gt;&lt;strike&gt;&lt;b&gt;Battery life&lt;/b&gt; was bad. &amp;nbsp;More worrying than battery life was the &lt;b&gt;heat generated by the laptop&lt;/b&gt;. &amp;nbsp;I found &lt;a href=&quot;http://putokaz.wordpress.com/2011/10/24/improving-power-consumption-on-ubuntu-laptop-with-sandy-bridge-processor/&quot;&gt;some tips to reduce power usage&lt;/a&gt; on&amp;nbsp;Putokaz blog, and tried it (thank you, voloder!). &amp;nbsp;While it did reduce power consumption, it also resulted in some screen update issues. &amp;nbsp;After some trial and error, I found that frame buffer compression was causing issues, so I left that one out.&lt;/strike&gt;&lt;br /&gt;
Update: Kubuntu 12.04 provides a very good battery life out of the box.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.zdnet.com/blog/perlow/geek-sheet-a-tweakers-guide-to-solid-state-drives-ssds-and-linux/9190&quot;&gt;ZDNet recommends&lt;/a&gt; disabling “elevator” I/O scheduler by passing &lt;code&gt;elevator=noop&lt;/code&gt; to kernel. &amp;nbsp;&lt;strike&gt;Based on tips from both sources,&lt;/strike&gt; I have updated my&amp;nbsp;&lt;code&gt;/etc/default/grub&lt;/code&gt;&amp;nbsp;to have this line:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet splash elevator=noop&quot;
&lt;strike&gt;GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet splash pcie_aspm=force i915.i915_enable_rc6=1 i915.lvds_downclock=1 elevator=noop&quot;&lt;/strike&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;strike&gt;(Power management flags&amp;nbsp;&lt;i&gt;may&lt;/i&gt; work on other computers with the same&amp;nbsp;Core i5-2467M&amp;nbsp;Sandy Bridge processor as well.)&lt;/strike&gt;&lt;/li&gt;
&lt;li&gt;Based on the same &lt;a href=&quot;http://www.zdnet.com/blog/perlow/geek-sheet-a-tweakers-guide-to-solid-state-drives-ssds-and-linux/9190&quot;&gt;ZDNet story mentioned before&lt;/a&gt;, I updated my &lt;code&gt;/etc/fstab&lt;/code&gt; as well. &amp;nbsp;I added &lt;code&gt;noatime&lt;/code&gt; flag to my ext4 partitions and mounted &lt;code&gt;/tmp&lt;/code&gt; on RAM using tmpfs. &amp;nbsp;(I didn’t change the caching parameters as that sounds a bit scary.)&lt;pre&gt;&lt;code&gt;UUID=dbccce1d-8e31-428e-a25a-227afc54651f /      ext4  &lt;b&gt;noatime&lt;/b&gt;  0  1
UUID=720c576c-2c1a-435f-ae90-9151acda2005 /home  ext4  &lt;b&gt;noatime&lt;/b&gt;  0  2
&lt;b&gt;tmpfs /tmp tmpfs nodev,nosuid,noexec,size=1G 0 0&lt;/b&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;Update&lt;/b&gt;: Someone was asking about battery life, so here&#39;s a screenshot of expected battery life. &amp;nbsp;With Ubuntu 12.04, you&#39;d get more than 5 hours of battery life on a full charge.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgadDre4iMo8evifYxny89GnbwwzGBCqYQJb-m1_tkh91G2qK8dyBLpMH3P5ZvRxjLwQELASfNoyfYS9Xl5D6ISiF05ktFYeEHKaVG1dvpR_6BsECwKfDU3FVl-w5GGSeGdM9ytajcjHjuN/s1600/z830-battery.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgadDre4iMo8evifYxny89GnbwwzGBCqYQJb-m1_tkh91G2qK8dyBLpMH3P5ZvRxjLwQELASfNoyfYS9Xl5D6ISiF05ktFYeEHKaVG1dvpR_6BsECwKfDU3FVl-w5GGSeGdM9ytajcjHjuN/s1600/z830-battery.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;style type=&quot;text/css&quot;&gt;
strike { color: #555; }
&lt;/style&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/3224446769446154274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/01/running-ubuntu-on-toshiba-z830.html#comment-form' title='18 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/3224446769446154274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/3224446769446154274'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/01/running-ubuntu-on-toshiba-z830.html' title='Running Ubuntu on a Toshiba Z830'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/KufEMtfDCTE/default.jpg" height="72" width="72"/><thr:total>18</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-4257099006418708932</id><published>2012-01-07T11:59:00.003+11:00</published><updated>2012-01-07T11:59:48.207+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Partitioning disk for installing Linux</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Are you installing Ubuntu on a new machine and you’re not sure how much storage space the installation would need or how to partition your disk? &amp;nbsp;I have a few suggestions:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Create separate partitions for Linux installation (mounted at &lt;code&gt;/&lt;/code&gt;) and data (mounted at &lt;code&gt;/home&lt;/code&gt;). &amp;nbsp;This way, you can completely wipe and reinstall your OS or switch to a different distro without worrying about data in your home directory.&lt;/li&gt;
&lt;li&gt;A typical Linux installation doesn’t need a lot of space. &amp;nbsp;I allocated 20GB for my root (&lt;code&gt;/&lt;/code&gt;) partition purely based on some guess work, but I’m using only about 7.2GB in that partition. &amp;nbsp;If I’m starting over again, I’d go with a 12 or even a 10GB partition. &amp;nbsp;(You’re a lot more likely to eventually run out of space on your home partition than on the root partition.)&lt;pre&gt;&lt;code&gt;% df -hl
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              19G  7.2G   11G  40% /
udev                  2.9G  4.0K  2.9G   1% /dev
tmpfs                 1.2G  996K  1.2G   1% /run
none                  5.0M     0  5.0M   0% /run/lock
none                  2.9G  2.8M  2.9G   1% /run/shm
/dev/sda6              93G   78G   11G  89% /home&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/4257099006418708932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2012/01/partitioning-disk-for-installing-linux.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/4257099006418708932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/4257099006418708932'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2012/01/partitioning-disk-for-installing-linux.html' title='Partitioning disk for installing Linux'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-8994056174091667238</id><published>2011-11-16T22:37:00.000+11:00</published><updated>2011-11-16T22:37:30.216+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Migrating to a new SSD without data loss</title><content type='html'>I have a Samsung N150 netbook that came with Windows 7 preinstalled on a 250GB hard disk. &amp;nbsp;I created a bunch of new ext4 partitions on this disk and was running &lt;a href=&#39;http://www.kubuntu.org/&#39;&gt;Kubuntu&lt;/a&gt; on it. &amp;nbsp;I almost never used Windows, but I had kept it on the disk anyway. &amp;nbsp;Last week I thought of upgrading to an SSD, and bought a 240GB SSD. &amp;nbsp;This post is to document how I copied over the Windows installation and recovery partition to the SSD before swapping the disks.&lt;br /&gt;
&lt;br /&gt;
I connected the SSD to my computer using an USB interface and ran &lt;code&gt;sudo fdisk -l&lt;/code&gt; to see the partition tables of both disks.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% sudo fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd937cf59

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    31459327    15728640   27  Hidden NTFS WinRE
/dev/sda2   *    31459328    31664127      102400    7  HPFS/NTFS/exFAT
/dev/sda3        31664128   232622079   100478976    7  HPFS/NTFS/exFAT
/dev/sda4       232624126   488394751   127885313    5  Extended
/dev/sda5       480397312   488394751     3998720   82  Linux swap / Solaris
/dev/sda6       232624128   291215359    29295616   83  Linux
/dev/sda7       291217408   480391167    94586880   83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 240.1 GB, 240057409536 bytes
255 heads, 63 sectors/track, 29185 cylinders, total 468862128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00045231

   Device Boot      Start         End      Blocks   Id  System
&lt;/code&gt;&lt;/pre&gt;&lt;code&gt;/dev/sda&lt;/code&gt; is the original hard disk that came with the laptop, and &lt;code&gt;/dev/sdb&lt;/code&gt;, which is empty currently, is the new SSD. &amp;nbsp;I have to clone the first 3 partitions (&lt;code&gt;/dev/sda1&lt;/code&gt;, &lt;code&gt;/dev/sda2&lt;/code&gt;, and &lt;code&gt;/dev/sda3&lt;/code&gt;) bit-by-bit to retain all the preinstalled stuff &amp;mdash; this includes Windows 7 installation and the recovery partition. &amp;nbsp;Replicating the Windows partitions is the tricky part, so this post will describe that in detail. &amp;nbsp;Copying data from Linux partitions can be done with a simple &lt;code&gt;&lt;a href=&#39;http://linux.die.net/man/1/rsync&#39;&gt;rsync&lt;/a&gt;&lt;/code&gt;.&lt;br /&gt;
&lt;br /&gt;
The first step is to create partitions on the new disk that resemble the old disk. &amp;nbsp;I followed the &lt;a href=&#39;http://tldp.org/HOWTO/Partition/fdisk_partitioning.html&#39;&gt;fdisk guide of TLDP&lt;/a&gt; and created the first 3 partitions. &amp;nbsp;Now &lt;code&gt;fdisk -l&lt;/code&gt; shows this configuration:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% sudo fdisk -l      

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd937cf59

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    31459327    15728640   27  Hidden NTFS WinRE
/dev/sda2   *    31459328    31664127      102400    7  HPFS/NTFS/exFAT
/dev/sda3        31664128   232622079   100478976    7  HPFS/NTFS/exFAT
/dev/sda4       232624126   488394751   127885313    5  Extended
/dev/sda5       480397312   488394751     3998720   82  Linux swap / Solaris
/dev/sda6       232624128   291215359    29295616   83  Linux
/dev/sda7       291217408   480391167    94586880   83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 240.1 GB, 240057409536 bytes
255 heads, 63 sectors/track, 29185 cylinders, total 468862128 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00045231

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    31459327    15728640   27  Hidden NTFS WinRE
/dev/sdb2   *    31459328    31664127      102400    7  HPFS/NTFS/exFAT
/dev/sdb3        31664128   232622079   100478976    7  HPFS/NTFS/exFAT
&lt;/code&gt;&lt;/pre&gt;The partitions in the new disk are of the same size and same type as in the old one. &amp;nbsp;&lt;code&gt;/dev/sdb2&lt;/code&gt; is bootable as is &lt;code&gt;/dev/sda2&lt;/code&gt;. &amp;nbsp;(It won&amp;rsquo;t boot yet though, since the disk has no OS yet.) &amp;nbsp;Now to copy the data bits over. &amp;nbsp;I first unmounted all three partitions. &amp;nbsp;This is critical because changing data underneath when it&amp;rsquo;s being copied over is a darn good recipe for data corruption.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;dd&lt;/code&gt; is the low-level data copying utility I used to clone the partitions. &amp;nbsp;Copying the data over was as simple as running these commands one by one. &amp;nbsp;(Swapping &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;of&lt;/code&gt; can result in wiping out all data from the old partition. &amp;nbsp;&lt;code&gt;dd&lt;/code&gt; cannot even know if you&amp;rsquo;re passing wrong arguments to it.)&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% sudo dd if=/dev/sda1 of=/dev/sdb1 conv=notrunc
% sudo dd if=/dev/sda2 of=/dev/sdb2 conv=notrunc
% sudo dd if=/dev/sda3 of=/dev/sdb3 conv=notrunc&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Copying can be painfully slow since we are moving hundreds of GBs around. &amp;nbsp;Blog O&amp;rsquo; Matty has a post that shows how to &lt;a href=&#39;http://prefetch.net/blog/index.php/2006/06/11/printing-dd-status/&#39;&gt;find status of a running &lt;code&gt;dd&lt;/code&gt; command&lt;/a&gt;. &amp;nbsp;Essentially you&amp;rsquo;d send &lt;code&gt;SIGUSR1&lt;/code&gt; signal to the &lt;code&gt;dd&lt;/code&gt; process and it&amp;rsquo;d print the current status of the transfer. &amp;nbsp;One of the commenters suggests running &lt;code&gt;sudo pkill -SIGUSR1 dd&lt;/code&gt; so that you don&amp;rsquo;t have to think about process IDs.&lt;br /&gt;
&lt;br /&gt;
Once this was done, I installed Kubuntu on the SSD using the standard installation process, and everything went just fine. &amp;nbsp;Windows doesn&amp;rsquo;t boot probably because it thinks mine is a pirated copy. &amp;nbsp;(Shows an error saying some &amp;lsquo;important&amp;rsquo; hardware has gone missing.) &amp;nbsp;But I can boot into the recovery partition, so I can restore factory settings to get Windows running again when I want it.&lt;br /&gt;
&lt;br /&gt;
I restored all my installed software from the &lt;a href=&#39;http://lists.samba.org/archive/linux/2002-June/003399.html&#39;&gt;package selection list&lt;/a&gt; I had already generated. &amp;nbsp;That&amp;rsquo;s it... the computer is exactly like it was before with all my programs and configuration.</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/8994056174091667238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2011/11/migrating-to-new-ssd-without-data-loss.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8994056174091667238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8994056174091667238'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2011/11/migrating-to-new-ssd-without-data-loss.html' title='Migrating to a new SSD without data loss'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-8812185892842010587</id><published>2011-11-12T15:56:00.000+11:00</published><updated>2011-11-12T15:56:37.827+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><title type='text'>Tweaking stack size of Linux processes to reduce swapping</title><content type='html'>Since upgrading to Kubuntu 11.10, my laptop has been slow. &amp;nbsp;Slow because it&amp;rsquo;s been accessing the hard disk a lot. &amp;nbsp;I incidentally opened &lt;a href=&#39;http://userbase.kde.org/KSysGuard&#39;&gt;system monitor&lt;/a&gt; yesterday and found that more than 1GB of &lt;a href=&#39;http://en.wikipedia.org/wiki/Paging&#39;&gt;swapping space&lt;/a&gt; was in use although only about 1.1GB of the total 2GB RAM was in use. &amp;nbsp;That doesn&amp;rsquo;t sound right. &amp;nbsp;The computer shouldn&amp;rsquo;t swap when about half of the RAM is unused.&lt;br /&gt;
&lt;br /&gt;
My friend &lt;a href=&#39;https://profiles.google.com/116209284740046623909&#39;&gt;Abhay&lt;/a&gt; had once &lt;a href=&#39;https://profiles.google.com/106688440131495596771/posts/WaJYHGAvRQs?authuser=0&#39;&gt;told me about thread stack size&lt;/a&gt; configuration of Linux (Unix?) processes. &amp;nbsp;This configuration specifies how much RAM is given to each thread for its stack. &amp;nbsp;I ran the following command to see how much was the current stack size:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% ulimit -s
8192&lt;/code&gt;&lt;/pre&gt;That&amp;rsquo;s 8192KB allocated for each thread. &amp;nbsp;With some Googling around I figured this was a huge number. &amp;nbsp;&lt;a href=&#39;http://msdn.microsoft.com/en-us/library/windows/desktop/ms686774(v=vs.85).aspx&#39;&gt;Windows allocates only 1MB&lt;/a&gt; by default. &amp;nbsp;For a machine that&amp;rsquo;s low on RAM like mine, 8MB for stack is ludicrous. &amp;nbsp;I decided to make it 2MB instead. &amp;nbsp;Unsurprisingly, I wasn&amp;rsquo;t the first to try to do something like this; a &lt;a href=&#39;http://www.linuxquestions.org/questions/red-hat-31/setting-ulimit-c-permanently-587291/&#39;&gt;thread on LinuxQuestions.org&lt;/a&gt; explained that I can edit &lt;a href=&#39;http://linux.die.net/man/5/limits.conf&#39;&gt;&lt;code&gt;/etc/security/limits.conf&lt;/code&gt;&lt;/a&gt; to set the default size.&lt;br /&gt;
&lt;br /&gt;
I added the following lines to my &lt;code&gt;/etc/security/limits.conf&lt;/code&gt;:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;* soft stack 2048
* hard stack 2048&lt;/code&gt;&lt;/pre&gt;(Only &lt;code&gt;root&lt;/code&gt; can modify this file; you&amp;rsquo;ll need to use &lt;code&gt;sudo&lt;/code&gt;.) &amp;nbsp;To apply the configuration changes I restarted the machine. &amp;nbsp;After restarting, now my machine is using about 1.4GB of RAM and about 80MB of swap. &amp;nbsp;No need to mention, everything is fast as it used be.</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/8812185892842010587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2011/11/tweaking-stack-size-of-linux-processes.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8812185892842010587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8812185892842010587'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2011/11/tweaking-stack-size-of-linux-processes.html' title='Tweaking stack size of Linux processes to reduce swapping'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-921343571020631819</id><published>2011-10-25T14:21:00.000+11:00</published><updated>2011-10-25T22:06:32.269+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><title type='text'>Opening new browser tab when Caps Lock key is pressed</title><content type='html'>After using a &lt;a href=&quot;http://www.google.com/chromebook/&quot;&gt;Chromebook&lt;/a&gt; for a while, I realised how useful mapping Caps Lock key to opening a new browser tab can be. &amp;nbsp;Of course, it&amp;rsquo;s possible to set up key bindings to achieve this in Linux.&lt;br /&gt;
&lt;br /&gt;
First, I set up &lt;code&gt;.Xmodmap&lt;/code&gt; so that pressing Caps Lock is interpreted as the same as pressing Calculator key on my multimedia keyboard. &amp;nbsp;I chose Calculator key because it doesn&amp;rsquo;t currently do anything, and I don&amp;rsquo;t use it at all. &amp;nbsp;I added the following lines to my &lt;code&gt;~/.Xmodmap&lt;/code&gt; file.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;remove Lock = Caps_Lock
keysym Caps_Lock = XF86Calculator&lt;/code&gt;&lt;/pre&gt;Now, pressing Caps Lock would be the same as pressing Calculator key.&lt;br /&gt;
&lt;br /&gt;
We need to make pressing Calculator key send &lt;kbd&gt;Ctrl+T&lt;/kbd&gt; keystrokes instead. &amp;nbsp;This can be done in KDE by defining a new global shortcut. &amp;nbsp;In KDE 4.7, this is done by navigating to &lt;em&gt;System Settings &amp;gt; Shortcuts and Gestures &amp;gt; Custom Shortcuts&lt;/em&gt;. &amp;nbsp;Define a new &lt;em&gt;Command/URL&lt;/em&gt; global shortcut. &amp;nbsp;Use &lt;kbd&gt;Caps Lock&lt;/kbd&gt; as the trigger shortcut (it would show as &lt;em&gt;Calculator&lt;/em&gt; in the UI). &amp;nbsp;Specify &lt;pre&gt;&lt;code&gt;/usr/bin/xte &quot;keydown Control_L&quot; &quot;key t&quot; &quot;keyup Control_L&quot;&lt;/code&gt;&lt;/pre&gt;as the command to run. &amp;nbsp;(You&amp;rsquo;d have to install &lt;a href=&#39;http://linux.die.net/man/1/xte&#39;&gt;xte&lt;/a&gt; if it isn&amp;rsquo;t already installed on your machine.) &amp;nbsp;That&amp;rsquo;s it; now pressing &lt;kbd&gt;Caps Lock&lt;/kbd&gt; anywhere within KDE would send &lt;kbd&gt;Ctrl+T&lt;/kbd&gt; keystrokes instead.&lt;br /&gt;
&lt;br /&gt;
A few tips:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;You can use &lt;code&gt;xmodmap -pk&lt;/code&gt; command to see the list of all available keys.&lt;/li&gt;
&lt;li&gt;Be sure to select a key that&amp;rsquo;s actually present on your keyboard; my laptop does not have a calculator key, so I am using the battery key instead. &amp;nbsp;Any key that&#39;s present in the keyboard but not currently in use would do.&lt;/li&gt;
&lt;li&gt;After you have modified your &lt;code&gt;~/.Xmodmap&lt;/code&gt;, you&amp;rsquo;ll have to log out and log back in for the mappings to apply. &amp;nbsp;Alternatively, you can apply the configuration to your current session from the command line, e.g. by running &lt;code&gt;xmodmap -e &quot;remove Lock = Caps_Lock&quot;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/921343571020631819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2011/10/opening-new-browser-tab-when-caps-lock.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/921343571020631819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/921343571020631819'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2011/10/opening-new-browser-tab-when-caps-lock.html' title='Opening new browser tab when Caps Lock key is pressed'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-8700639142847887763</id><published>2011-10-23T20:29:00.001+11:00</published><updated>2011-10-23T20:29:51.945+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="zsh"/><title type='text'>zsh syntax highlighting</title><content type='html'>I like colours. &amp;nbsp;I have aliased all frequently used commands like &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;grep&lt;/code&gt;, etc. by adding flags to show colours in the output. &amp;nbsp;I have set my &lt;code&gt;PS1&lt;/code&gt; in such a way that the prompt is in a different colour. &amp;nbsp;It makes it easy for me to see where the prompt ends and the command starts. &amp;nbsp;When I heard about &lt;a href=&#39;http://en.wikipedia.org/wiki/Friendly_interactive_shell&#39;&gt;fish&lt;/a&gt; and that it does syntax highlighting, I was tempted to switch to it. &amp;nbsp;But I couldn&amp;rsquo;t because it didn&amp;rsquo;t do certain things I needed. &amp;nbsp;(I don&amp;rsquo;t remember the details now.) &amp;nbsp;Soon after that I found out that it&amp;rsquo;s very simple to add syntax highlighting to zsh!&lt;br /&gt;
&lt;br /&gt;
All you have to do is download the code from &lt;a href=&#39;https://github.com/zsh-users/zsh-syntax-highlighting&#39;&gt;zsh-syntax-highlighting&lt;/a&gt; project and &amp;ldquo;source&amp;rdquo; it in your &lt;code&gt;.zshrc&lt;/code&gt;. &amp;nbsp;But I wasn&amp;rsquo;t happy with their defaults. &amp;nbsp;By default this script underlines path names, but I hate underlining because it makes text less readable. &amp;nbsp;I also didn&amp;rsquo;t like their choice of blue colour for &lt;a href=&#39;http://en.wikipedia.org/wiki/Glob_(programming)&#39;&gt;globs&lt;/a&gt;. &amp;nbsp;On my black terminal, blue is hardly readable. &amp;nbsp;Customising the formatting was easy too; I only had to change the value of a variable. &amp;nbsp;This is what my .zshrc has now, and syntax highlighting works like a charm.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;source ~/dload/src/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_STYLES[globbing]=&#39;fg=yellow&#39;
ZSH_HIGHLIGHT_STYLES[path]=&#39;bold&#39;
&lt;/code&gt;&lt;/pre&gt;You can find the list of different syntax highlighting options in &lt;a href=&#39;https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/highlighters/main/main-highlighter.zsh&#39;&gt;this file&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/8700639142847887763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2011/10/zsh-syntax-highlighting.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8700639142847887763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8700639142847887763'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2011/10/zsh-syntax-highlighting.html' title='zsh syntax highlighting'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-6285956865999395007</id><published>2011-10-20T13:23:00.001+11:00</published><updated>2011-10-20T13:23:53.571+11:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="zsh"/><title type='text'>Terminating scripts when any individual command fails</title><content type='html'>Let&amp;rsquo;s say you have a script that builds a project, runs all tests, and pushes the binary to a staging/production server. &amp;nbsp;If the build fails or a test fails you&amp;rsquo;d want the script to stop immediately. &amp;nbsp;Pushing a binary that failed some tests is obviously wrong. &amp;nbsp;You can check for a command&amp;rsquo;s return value using &lt;code&gt;if&lt;/code&gt; and terminate your script. &amp;nbsp;But doing that for every command in the script would make your script less readable and more prone to bugs.&lt;br /&gt;
&lt;br /&gt;
Shells provide a clean solution for this use case: you can set a script-level option to stop the script execution if any command you invoke from the script exits with a non-zero status. &amp;nbsp;You do that in bash using&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;set -e&lt;/code&gt;&lt;/pre&gt;and in zsh using&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;setopt err_exit&lt;/code&gt;&lt;/pre&gt;So your script would essentially look like this:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
set -e
make
make test
make push&lt;/code&gt;&lt;/pre&gt;zsh also has a &lt;code&gt;err_return&lt;/code&gt; option that can be set to make a function return (as opposed to terminating the whole script) when a command invoked by a function fails.</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/6285956865999395007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2011/10/terminating-scripts-when-any-individual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/6285956865999395007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/6285956865999395007'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2011/10/terminating-scripts-when-any-individual.html' title='Terminating scripts when any individual command fails'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-1994422810501173998</id><published>2011-09-30T17:21:00.000+10:00</published><updated>2011-09-30T17:21:35.870+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>Vim&#39;s text objects</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Let&#39;s say I have this line in a file:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;logging.info(&quot;some boring message&quot;)&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;and I want to change it to:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;logging.info(&quot;request served&quot;)&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;For a long time I did it this way:&lt;br /&gt;
1. keep the cursor on &#39;&lt;code&gt;s&lt;/code&gt;&#39; of &#39;&lt;code&gt;some&lt;/code&gt;&#39;&lt;br /&gt;
2. type &lt;kbd&gt;ct&quot;&lt;/kbd&gt; (which means change till (the first) &lt;code&gt;&quot;&lt;/code&gt; character)&lt;br /&gt;
3. type &lt;kbd&gt;request served&lt;/kbd&gt;.&lt;br /&gt;
&lt;br /&gt;
Recently I figured there&#39;s an easier/faster way:&lt;br /&gt;
1. keep the cursor anywhere inside the &lt;code&gt;&quot;some boring message&quot;&lt;/code&gt; string&lt;br /&gt;
2. type &lt;kbd&gt;ci&quot;&lt;/kbd&gt; (which means change &lt;i&gt;inside quotes&lt;/i&gt;)&lt;br /&gt;
3. type &lt;kbd&gt;request served&lt;/kbd&gt;.&lt;br /&gt;
&lt;br /&gt;
Like every Vim feature, this is just one among a dozen or so possible selections.&amp;nbsp; Check out &lt;a href=&quot;http://vimdoc.sourceforge.net/htmldoc/motion.html#object-select&quot;&gt;text objects&lt;/a&gt; section in Vim manual.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/1994422810501173998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2011/09/vims-text-objects.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/1994422810501173998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/1994422810501173998'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2011/09/vims-text-objects.html' title='Vim&#39;s text objects'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-8998294661722403619</id><published>2011-08-06T20:59:00.000+10:00</published><updated>2011-08-06T20:59:32.939+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="All Linux"/><title type='text'>Shortcut key to switch to any app</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I use the command line quite a bit, so I always keep a Konsole window running. &amp;nbsp;Since I frequently switch to the Konsole window, I thought it&#39;d be much faster if I can bind a global shortcut key. &amp;nbsp;Like with most things in Linux, the solution is only a Google search away :)&lt;br /&gt;
&lt;br /&gt;
I had to install &lt;code&gt;wmctrl&lt;/code&gt; first (&lt;code&gt;sudo apt-get install wmctrl&lt;/code&gt; on Ubuntu). &amp;nbsp;And then I bound the shortcut key &lt;kbd&gt;Ctrl+Shift+K&lt;/kbd&gt; from my KDE&#39;s settings dialog to run the command &lt;code&gt;wmctrl -x -a konsole.Konsole&lt;/code&gt;. &amp;nbsp;&lt;code&gt;-x&lt;/code&gt; says that I would be specifying windows using their WM_CLASS values; &lt;code&gt;-a&lt;/code&gt; activates the window that follows it. &amp;nbsp;To get the list of currently open window with their WM_CLASS values, I used the command &lt;code&gt;wmctrl -xl&lt;/code&gt;.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/8998294661722403619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2011/08/shortcut-key-to-switch-to-any-app.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8998294661722403619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/8998294661722403619'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2011/08/shortcut-key-to-switch-to-any-app.html' title='Shortcut key to switch to any app'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2257094104851086843.post-3028399321441537183</id><published>2011-07-31T14:28:00.002+10:00</published><updated>2011-07-31T14:28:40.558+10:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="zsh"/><title type='text'>Finding information about commands you use</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;Q&lt;/b&gt;: How to find out&amp;nbsp;where the binary of a command I&#39;m running?&lt;br /&gt;
&lt;b&gt;A&lt;/b&gt;: You can use &lt;i&gt;type&lt;/i&gt; command (available on both zsh and bash):&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% type ls
ls is an alias for ls -h --color=auto
% type cat
cat is /bin/cat
% type alias
alias is a shell builtin&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Q&lt;/b&gt;: Sometimes I want to know if a command is a shell script or a compiled binary. &amp;nbsp;How do I do that?&lt;br /&gt;
&lt;b&gt;A&lt;/b&gt;: If you use zsh, you can use &lt;i&gt;=command&lt;/i&gt; to get to &lt;i&gt;command&lt;/i&gt;&#39;s full path.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% file =backup
/home/manki/d/bin/backup: a /bin/rbash script text executable
% # To show you what =backup actually translates to&lt;/code&gt;&lt;code&gt;
% echo =backup
/home/manki/d/bin/backup
&lt;/code&gt;&lt;/pre&gt;
If you use bash, you can use type command within &lt;a href=&quot;http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html#sect_03_04_04&quot;&gt;backticks&lt;/a&gt; or the equivalent $(...).&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;$ file `type -p backup`
/home/manki/d/bin/backup: a /bin/rbash script text executable&lt;/code&gt;&lt;/pre&gt;
When you have aliases, this can get tricky. &amp;nbsp;On bash I don&#39;t know how to do this, but zsh is smart enough to find the executable even when you have aliases set up. &amp;nbsp;For instance, I have aliased &lt;i&gt;ls&lt;/i&gt; to &lt;i&gt;ls -h --color=auto&lt;/i&gt;, but zsh gives me the right binary for &lt;i&gt;=ls&lt;/i&gt;:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;% file =ls    
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://linuxtips.manki.in/feeds/3028399321441537183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://linuxtips.manki.in/2011/07/finding-information-about-commands-you.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/3028399321441537183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2257094104851086843/posts/default/3028399321441537183'/><link rel='alternate' type='text/html' href='http://linuxtips.manki.in/2011/07/finding-information-about-commands-you.html' title='Finding information about commands you use'/><author><name>Manki</name><uri>http://www.blogger.com/profile/01719555448858778552</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGtv7RZxZ-oSk4hZ1-mhF6NT7lE-AYd6BgEA7W2J0Jl90eKbKGBD9TKPM7_WrPdsPgun4QoadKgFvSd-61oAgFy-t6XraQa6HoqKALP6pad1gN6RmPZjiF5QUvwduIbwuXn71906OLToqFnEQOjNxM0eCUD-Qfx3QH8Qw4hoaQoSU0Pw/s220/IMG_20240811_113936302_HDR.jpg'/></author><thr:total>0</thr:total></entry></feed>