Unix learning tips from Miguel de Icaza

Miguel de Icaza – a very well known programmer in Linux circles – shares a few tips to having a better experience in Unix environments.  Here is a summary of what he recommends:

  • Read, learn, and memorize the “Unix Programming Environment” book by Kernighan and Pike.
  • Read and learn the “Unix for the impatient” book by Abrahams and Larson.
  • Learn Emacs.
  • Use Midnight Commander, which Miguel is the author of.  Here is a handy manual.
  • Keep a copy of the “Unix Power Tools” book nearby.
  • Learn touch typing.

These are all solid recommendations.  I’d suggest to use Vim instead of Emacs, but that’s more of a personal preference – learn one or the other.  And I can’t agree more on the touch typing.  That is indeed the most important skill that you will ever learn.  Right next to the camp fire starting.

At this point you might be thinking “I am awesome”, “the world is my oyster” and “Avatar 3D was not such a bad movie”.

But unless you touch-type, you are neither awesome, nor you are in a position to judge the qualities of the world as an oyster or any James Cameron movies.

You have to face the fact that not only you are a slow typist, you do look a little bit ridiculous. You are typing with two maybe three fingers on each hand and you move your head like a chicken as you look at you alternate looking at your keyboard and looking at your screen.

Do humanity a favor and learn to touch type.

Mind + computer > mind

Obviously, isn’t it?  Well, my brother posted this garbled piece of text, which is supposed to show you how awesome your mind is.

7H15 M3554G3 53RV35 7O PR0V3 H0W 0UR M1ND C4N D0 4M4Z1NG 7H1NG5, 1MPR3551V3 7H1NG5! 1N 7H3 B3G1NN1NG 17 WA5 H4RD BU7 N0W, 0N 7H15 LIN3 Y0UR M1ND 1S R34D1NG 17 4U70M471C4LLY W17H0U7 3V3N 7H1NK1NG 4B0U7 17, B3 PROUD! 0NLY C3R741N P30PL3 C4N R3AD 7H15.
R3-P057 1F U C4N R35D 7H15… !!!

And I agree, it is. But I think that mind with some extra computing power is even better. It took me just a few seconds to instruct my computer how to do a readable translation for me. Much less time than it takes me to read the garbled text.  For those of you with a Linux command line nearby:

$ cat message.txt | tr 715340 TISEAO

For those of you without a shell nearby and not an amazing mind, here is a “deciphered” version of the text:

THIS MESSAGE SERVES TO PROVE HOW OUR MIND CAN DO AMAZING THINGS, IMPRESSIVE THINGS! IN THE BEGINNING IT WAS HARD BUT NOW, ON THIS LINE YOUR MIND IS READING IT AUTOMATICALLY WITHOUT EVEN THINKING ABOUT IT, BE PROUD! ONLY CERTAIN PEOPLE CAN READ THIS.
RE-POST IF U CAN RESD THIS… !!!

tmux – Linux terminal multiplexer

I stumbled upon a very useful tool – tmux.  It is a terminal multiplexer for Linux.  If you are using Terminator or screen, you’d want to check it out. If you don’t use either of those, you definitely need to check it out.

With tmux, you can have a single shell in which you can create multiple sessions.  You can split each session into a number of windows.  You can detach from tmux and all your sessions and windows will remain open and running, much like with screen.  Later you can attach back to them again or you can start a totally new instance.  The interface is keyboard driven.  It is simple and intuitive, but as with any other tool, you’ll need a bit of time to get used to it.

If you are a Fedora Linux user, all you have to do to try it out is: ‘yum install tmux‘.  If you can read Russian, here is a quick introduction to most useful shortcuts.  Check the official website for the rest of the documentation.

Old MacDonald had a file

Here is a bit of office humor from today:

Old MacDonald had a file, ee-i-ee-i-o,
And on that file he had a change, ee-i-ee-i-o,
With a diff-diff here, a patch-patch there,
Diff-patch, diff-patch everywhere,
Old MacDonald had a file, ee-i-ee-i-o.

P.S.: Those of you who don’t get it, should take a moment to learn about diff and patch utilities.  For example, by reading this article.

chmod text modes

I came across this blog post which praises text modes for /bin/chmod.

There are two ways you can change file permissions in Unix – one is using chmod‘s symbolic (text) modes (like chmod ug+x file), the other is using the octal modes (like chmod 0660 file). It turns out that symbolic modes are more powerful because you can mask out the permission bits you want to change! Octal permission modes are absolute and can’t be used to change individual bits. Octal modes are also sometimes called absolute because of that.

I have to agree, they are superior.  However I feel like the article needs more examples.  So here we go.

Use “u” for user, “g” for group, “o” for others, and “a” for all, or you can use a combination of letters, similar to how you do for access rights:


$ chmod ug+rw *.php

This will make all .php files in current directory readable and writable by both user and group.

Use several permission changes within one command.  Just separate them by comma.


$ chmod a-rwx,ug+rw,o+r *.php

The above will reset permissions on all .php files to readable by all and writable only by user and group.

And my favorite and most used example, which would be tricky with octal permissions is the “X”.  In recursive change mode, “X” will affect executable bit only on directories.  Difference by illustration:


$ chmod -R a+x /some/path

The above will add executable bit to all files and folders under /some/path.


$ chmod -R a+X /some/path

But the above will add executable bit only to folders under /some/path.  The files will remain as they are.