{"id":602,"date":"2010-07-10T22:51:03","date_gmt":"2010-07-11T04:51:03","guid":{"rendered":"http:\/\/jaredrobinson.com\/blog\/?p=602"},"modified":"2010-07-10T22:51:03","modified_gmt":"2010-07-11T04:51:03","slug":"miscellaneous-linux-tips-and-tricks","status":"publish","type":"post","link":"https:\/\/jaredrobinson.com\/blog\/miscellaneous-linux-tips-and-tricks\/","title":{"rendered":"Miscellaneous Linux tips and tricks"},"content":{"rendered":"<p><strong>Gnome Key Bindings and IntelliJ IDEA<\/strong><\/p>\n<p>IntelliJ IDEA key bindings conflict with Gnome&#8217;s window manager. In IDEA, I can type CTRL-B to jump to a symbol definition. Normally, I&#8217;d type CTRL-ALT-LEFTARROW to navigate back to where I had come from. Gnome&#8217;s MetaCity intercepts that key mapping before IDEA sees it, and tries to move my desktop to the left. There are several other Gnome\/Metacity key bindings that conflict with IntelliJ IDEA. Rather than remap the keys in Gnome, I found that on Fedora, I could add the Windows key to the mix, and Gnome would ignore it, and pass it along to IDEA. This means that I can type CTRL-ALT-WINDOWS-LEFTARROW to navigate backward, and so forth.<\/p>\n<p>Unfortunately, this doesn&#8217;t work in RHEL 5 and CentOS 5. The solution is to Go to the Gnome menu bar and select System > Preferences > Keyboard (not Keyboard Shortcuts). Then select the &#8220;Layout Options&#8221; tab, and expand the &#8220;Alt\/Win key behavior&#8221;. Then I select &#8220;Super is mapped to the Win-keys&#8221;.<\/p>\n<p>Every time I log in after that, Gnome tells me that my X keyboard settings conflict with my Gnome Keyboard settings, and it asks which I want to use. Selecting the Gnome settings is what I want.<\/p>\n<p><strong>Bandwidth limiting downloads with &#8216;curl&#8217; or &#8216;wget&#8217;<\/strong><\/p>\n<p>When downloading a large file, it&#8217;s nice to be polite to others on the network, so I use the <code>--limit-rate<\/code> option for curl and wget:<\/p>\n<p>* <code>curl -O --limit-rate 20k http:\/\/server.com\/linux.iso<\/code><br \/>\n* <code>wget --limit-rate=20k http:\/\/server.com\/linux.iso<\/code><\/p>\n<p><strong>GDB TUI (text user interface)<\/strong><\/p>\n<p>After starting gdb, it&#8217;s possible to switch to its text user interface with CTRL-X, CTRL-A. Typing it a second time exits TUI mode.<\/p>\n<p><strong>Vim C++ Auto completion with ctags<\/strong><\/p>\n<p>I appreciate full blown IDEs in Linux, but I like the quick start up time of vim. Until recently though, I didn&#8217;t have C++ auto completion (also known as vim omni completion). <\/p>\n<p>This got me up and running, and was a great resource:<br \/>\n<a href=\"http:\/\/vim.wikia.com\/wiki\/C%2B%2B_code_completion\">http:\/\/vim.wikia.com\/wiki\/C%2B%2B_code_completion<\/a><\/p>\n<p>This would have been useful if I was a new comer to vim and ctags:<br \/>\n<a href=\"http:\/\/www.justlinux.com\/nhf\/Programming\/Introduction_to_C_Programming.html\">http:\/\/www.justlinux.com\/nhf\/Programming\/Introduction_to_C_Programming.html<\/a><\/p>\n<p><strong>xdg-open, gnome-open, start, cygstart<\/strong><\/p>\n<p>How to easily open files and URLs from the command line<br \/>\n<a href=\"http:\/\/www.dwheeler.com\/essays\/open-files-urls.html\">http:\/\/www.dwheeler.com\/essays\/open-files-urls.html<\/a><\/p>\n<ul>\n<li>Linux: <code>xdg-open filename_or_URL<\/code><\/li>\n<li>Linux:<code> gnome-open filename_or_URL<\/code><\/li>\n<li>Mac:  <code>open filename_or_URL<\/code><\/li>\n<li>\nWindows:  <code>cmd \/c start filename_or_URL<\/code><\/li>\n<li>Cygwin: <code>cygstart filename_or_URL<\/code><\/li>\n<\/ul>\n<p><strong>Nomachine NX and ALT-TAB<\/strong><\/p>\n<p>I use the Nomachine NX client from time to time to get a remote-desktop like connection to a remote Linux machine. It&#8217;s faster than VNC, but it suffers from not forwarding all of my keyboard shortcuts to the remote end of the connection.<\/p>\n<p>Usually, I start the nxlcient from within a Gnome login session. Gnome happily grabs ALT-TAB before the NX client gets to see it. That&#8217;s not what I want. To work around this limitation, I log into a virtual terminal, and start X manually as follows:<\/p>\n<p>Type CTRL-ALT-F2<br \/>\nLogin<br \/>\nRun: <code>startx -- :1 gnome-terminal<\/code><\/p>\n<p>From the gnome-terminal, run: <code>nxclient<\/code><\/p>\n<p>And then I connect to the remote machine in full screen mode. There&#8217;s no local window manager to interfere with my keyboard shortcuts.<\/p>\n<p><strong>Remote desktop and dual screens<\/strong><\/p>\n<p>I&#8217;ve been using Remote Desktop to connect to Windows XP, Vista and 7 machines. Until Windows 7, there was no way for a local computer having dual monitors to connect and have the remote end display across both monitors.<\/p>\n<p>So I used linux&#8217;s &#8216;rdesktop&#8217; program to do it:<\/p>\n<p><code>rdesktop -0 -a16 -f -rdisk:CLIENT=\/home\/jared\/Desktop -r sound remote.host.com<\/code><\/p>\n<p>I notice that in Windows 7, there are some new options in the Remote Desktop client (mstsc.exe): \/multimon and \/span. Or run <code>mstsc \/?<\/code> to list all possible options.<\/p>\n<p><strong>Editing windows registry files on Linux<\/strong><\/p>\n<p>Use Gedit: <code>gedit --encoding=UTF-16LE myfile.reg<\/code><\/p>\n<p>Gvim: <code>LANG=UTF-16LE gvim myfile.reg<\/code><\/p>\n<p>If already in gvim:<code> :e! ++enc=utf-16le<\/code><br \/>\nor  <code>:e ++enc=utf-16le myfile.reg<\/code><\/p>\n<p>Convert, edit, convert:<\/p>\n<p><code>iconv -f UTF-16LE -t utf-8 myfile.reg > myfile.reg.utf8<\/code><\/p>\n<p>Edit myfile.reg.utf8, then convert it back<\/p>\n<p><code> iconv -f utf-8 -t UTF-16LE myfile.reg.utf8 > myfile.reg<\/code><\/p>\n<p><strong><br \/>\nHow Firefox opens files and mime types<\/strong><\/p>\n<p>I needed to give Firefox some extra help knowing how to open a custom file type with a custom application. Here&#8217;s some helpful information.<\/p>\n<p><a href=\"https:\/\/developer.mozilla.org\/en\/How_Mozilla_determines_MIME_Types\">https:\/\/developer.mozilla.org\/en\/How_Mozilla_determines_MIME_Types<\/a><\/p>\n<p>Firefox uses mime.types on Linux, as well as other things. I helped Firefox by the mime type to the link in the generated HTML file. Either one of the following seems to work:<\/p>\n<p>* &lt;a href=&#8221;file:subdir\/file1.cst&#8221; type=&#8221;application\/octet-stream&#8221;&gt; open file &lt;\/a&gt;<br \/>\n* &lt;a href=&#8221;file:subdir\/file1.cst&#8221; type=&#8221;application\/x-extension-cst&#8221;&gt; open file  &lt;\/a&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gnome Key Bindings and IntelliJ IDEA IntelliJ IDEA key bindings conflict with Gnome&#8217;s window manager. In IDEA, I can type CTRL-B to jump to a symbol definition. Normally, I&#8217;d type CTRL-ALT-LEFTARROW to navigate back to where I had come from. Gnome&#8217;s MetaCity intercepts that key mapping before IDEA sees it, and tries to move my &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/jaredrobinson.com\/blog\/miscellaneous-linux-tips-and-tricks\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Miscellaneous Linux tips and tricks&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,9,12,17],"tags":[],"class_list":["post-602","post","type-post","status-publish","format-standard","hentry","category-fedora","category-linux","category-programming","category-tech"],"_links":{"self":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/602","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/comments?post=602"}],"version-history":[{"count":11,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/602\/revisions"}],"predecessor-version":[{"id":613,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/posts\/602\/revisions\/613"}],"wp:attachment":[{"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/media?parent=602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/categories?post=602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaredrobinson.com\/blog\/wp-json\/wp\/v2\/tags?post=602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}