Robert de Bock

Your blog titles analysed

Here are two tools that help you check your title or just a keyword for the Digg factor.

Lets try it with this article. Initial title was "Creating a Digg ready article". Only "article" is a good word. Total score: 0.37%. Likely not good enoug. After some tries, this title seems to be better: "Your blog titles analysed". Better! Total score: 96.36%

Well, I love the tool will use it in the future. Thanks Dan Zarrella!

Me in IT is mentioned in Alexa!

Okay, it's not big, but since a few days I saw that Alexa keeps statistics of this website. My understanding was only the top 100.000 websites were tracked.

Shell trick: repeat all arguments of the last command

Here is a simple trick that repeats all arguments of the previous command. Imagine you are first "touching" a specific list of files and need to do another action to is, like "chowning" it.

Rather then typing all files again, use something like this:

$ touch a set of files
$ chown robert:debock !$

This trick saved me so much time, I could afford it to write this article! ;-)

10 things you should do after installing Drupal

Here is a list of items I always do after installing Drupal. Please tell me what you are doing differently when initializing Drupal using the comments below.

  1. Make user #1. This user should be the administrator of your website. Other types of users, like authors, visitors, etc can be added later.
  2. Change Site Information. (/admin/settings/site-information) This changes the header and title of your newly created website. The information put here should be thought about very thoroughly as it is also used by search engines to understand what your website has to offer.
  3. Enable module Color, Statistics, Menu, Path and Contact. (/admin/build/modules) The color module is a cheap way to change the looks of your website a little bit. Statistics are cool, you can track what content is being seen. The Menu module allows you to create and manipulate the navigation of your website. The Path module is to change URLs from ugly /node/123 to more readable URLs like /article-about-me. The Contact module can be used to setup a contact form.
  4. Enable clean URLs. (/admin/settings/clean-urls) Instead of the ugly URLs ?q=something, you can use /something. This help users track where they are and also help search engines understand your website navigation better.
  5. Add a category for content. For navigation purposes it's easy to add content to a category. To allow this, you will have to add a category. I add a category for each type of content. Articles go into Articles, Images into the category Images. Add at least one term into each category.
  6. Edit the Primary Links. These links should be essential, like Home, Products, Support, Contact, etc. Also don't forget that these pages should be accessible with URLS that correspond to the content. (/, /products, /support, /contact) This helps users and search machines understand the navigation and content of your website.
  7. Install module Update Status, Google Analytics, Search 404, Global Redirect and Captcha. Update Status tells you when new versions of Drupal or third party modules are available. Google Analytics can track visitors, where they come from, what they visit, and many other tricks. This requires a Google Analytics account. Search 404 helps lost users find things. Instead of displaying a "page not found" message, it searches your website with the path that the user has entered. Global Redirect redirects visitors that (accidentally) visit an ugly URL to a pretty URL. Captcha will help you limit the amount of spam by asking a simple question like "What is the result of 13-10?". Good for comments and adding users.
  8. Redirect 403s to /user/login and 404 to /search404. This helps users navigate to the correct pages when they don't have access (403) or can't find (404) the things they are looking for. Especially good for website that migrate from one structure to another, like Drupal.
  9. Add a roll for Administrators, Authors, et cetera. When your website is created by more than one person, you should think about access permissions. Add a few roles and assign them a set of rights.
  10. Color the Garland theme. (/admin/build/themes/settings/garland) This is a cheap trick to personalize your website. Also replace that drop by a logo you have.

After doing all these steps you are ready to create content and launch your website. You don't need all these steps to create content, but I hope it will help you setup a Drupal website you can use for many years to come.

Impress friends with 5 vi(1) tricks

If ever you need to persuade a friend/colleague to use vi(1) instead of emacs(1) or nano(1), here are a few tricks that are cool in vi(1).

1. Replace all occurrences of "window" by "penguin"

Press escape a few times to enter command mode and then type the magical string:


The g at the end is optional, it means "global" and continues in a line instead of skipping to the next to search for other occurrences.

2. Load/read a file into the file you are editing

Press escape a few times to enter command mode and then use:

:r /path/to/file

You now have inserted that file into your current session.

3. Load/read output of commands to the file you are editing

Press escape a few times to enter command mode and almost the same as above:

:r!grep pattern file

Wow, this is cool!

4. More ways to save (and end) your file

After pressing escape a few times again, you can save (and quit) using these tricks:

  • :wq! Write, Quit and overwrite if existing.
  • :x Same as :wq!
  • ZZ Save and quit.

5. Moving around quickly

Here are a few tricks to move the cursor faster:

  • :10 Go to line number 10. Perfect when scripts stop and tell you what line caused the error.
  • G Go to the end of the document, beginning of that line.
  • $ Go to the end of the line.
  • 0 Go to the beginning of the line.

Good luck with vi(1)

Mythbusting 5 UNIX/Linux myths

Inspired by Discovery Mythbusters. Lets take a look at a few myths around the different shells and other Open Source or UNIX/Linux components that exist. To test these myths in a science-grade method I have asked my 4 direct colleagues to comment on these myths. Thanks Alan, Murat, Erick and Maxim!

The Korn Shell (ksh) is for old people

  • Alan: Middle-age
  • Murat: Neutral-age
  • Erick: Shit-head-age, but okay to use for OpenBSD because of license
  • Maxim: Not-old-age
  • Robert: Old-stubborn-age

plausable - busted

The Bourne shell (sh) is for UNIX, the Bourne Again (bash) shell for Linux

  • Alan: Is it a movie? Could well be.
  • Murat: Not true, both can mix.
  • Erick: True!
  • Maxim: Don't know.
  • Robert: Partially true.

plausable - busted

The Turbo C Shell (tcsh) is for programmers

  • Alan: Yeah.
  • Murat: Don't think so, every shell is okay.
  • Erick: No opinion.
  • Maxim: Don't know it.
  • Robert: Agree.

plausable - busted

Solaris is actually SLOWlaris

  • Alan: No!
  • Murat: Don't know, don't think so.
  • Erick: Not true!
  • Maxim: No
  • Robert: Not always true.

plausable - busted

OpenBSD is more secure

  • Alan: Supposedly
  • Murat: That's what they say!
  • Erick: Yes and no.
  • Maxim: Yes
  • Robert: Mostly yes.

plausable - busted

UNIX/Linux permissions on file/directories

I understand from non UNIX-ers that permissions can be challenging to understand. This article should get you going on any UNIX/Linux like operating system.

Each file (or directory) has a permissions based on identity:

  1. User this is the single person that owns the file.
  2. Group maybe users are part of a group.
  3. Other this is the rest of the world.

And each identity (user, group and other) can have a set of permissions. These can be expressed in more than one way; the whole word, the character representation of it or the numerical representation of it.

  1. Read or R or 4 the identity is allowed to read the file
  2. Write or W or 2 and now an identity is able to write to a file
  3. Execute or X or 1 makes identities being able to execute

Now that you know this, lets take a look at a listing of a few file, using ls(1) command: ls -l.

$ ls -l
total 16
drwxr-xr-x  2 robert users 4096 Dec 27 14:51 bin
-rwxr-x---  1 robert users 31 Feb 14 09:13
-rw-r--r--  1 robert users 13 Feb 14 09:12 textfile

The first column represent these permissions, the third and fourth column refer to user and group. So; the directory "bin" has these permissions: drwxr-xr-x Lets go over the individual characters:

  1. d This "thing" is a directory. For files it's a - sign.
  2. r This is the User part. The user has "read" permission.
  3. w The user has "write" permission. (Which means he can make new files inside this directory.)
  4. x The user has "execute" permission. (Which means he can change directory (cd(1)) into this directory.)
  5. r This is the group part, the group can read.
  6. - This is where "write" could have been. The group can't write in this directory.
  7. x The group has execute permission, the group is able to go into the directory.
  8. r This is the "other" (not user nor group) part. Everyone else can read.
  9. - Others can't write.
  10. x Others can execute/go into this directory.

You can repeat the same for those two other files. The difference is that and textfile are not directories, so:
Write means to have the ability to write in that file, aka modify.
Execute means the file can be executed, if there is code inside that actually does things, you are normally dealing with a program.

If you would express permissions with a number, you first split up the three parts, then count permissions for each part. For example:

  • rwx = 7 (r=4, w=2, x=1)
  • r-x = 5 (r=4, x=1)
  • r-- = 4 (r=4)

Some logical combinations are:

  • 777 everybody can do anything. (This can be dangerous!)
  • 750 user can do anything, group can't write, other can't do anything.
  • 640 user can read/write, group can read, others can't do anything.
  • 000 everybody can't do anything. (Except root) (This functionally locks files or directories)

Some strange combinations are 057, 077, 040, 007, etc.

Good, you are almost up to speed. One thing remaining; how to set or modify these permission. There are a few tools to help you:

  • chmod(1) Change (permission) modes for a file or directory.
  • chown(1) Change owner (and optionally group) of a file or directory.
  • chgrp(1) Change the group of a file or directory.

So, when you create a file, and would like to restrict a file to be only readable by the owner, you would use this command:

$ chmod 400 file

You could also use the more readable syntax of chmod(1):

$ chmod o-rwx,g-rwx,u-xw,u+r file

This tells chmod to (in order) remove (-) read write and execute (rwx) permissions for the others (o) of file. Then also remove all permission for the group, remove execute and write permissions and add read permissions to the user.

As using the human readable syntax for chmod requires more typing, it is almost better to use the numerical format. The only exception is when you only want to add on permission (like execute) without interfering with already existing permissions.

chown(1) is used change the owner of a file. It's rather straight forward:

$ chown robert:users

You can also remove that :users part to only change the owner of a file

chgrp(1) is even more straight forward, it changes the group of a file or directory:

$ chgrp users file

You have learned a major component of UNIX/Linux/*BSD operating systems. If you need more help, also see the man(1) pages of chmod(1), chown(1) and chgrp(1) by typing man chmod for example.

Open Source does not mean free

In my profession (UNIX/Linux and *BSD environments) Open Source is commonly used. My personal vision is that Open Source does not specifically imply free. Let's see what a randomly selected group of people answer to the question:

"Is Open Source software Free software?"

Person 0: No, for example Linux is not free; you are not free to do what you want.
Person 1: Open Source is not Free Software. Open Source is possibly free.
Person 2: Linux is financially free.
Person 3: Yes, Open Source software is free.

Wow, the answers are actually not what I expected. There is a difference in interpretation of Free. Lets take a look:

It seems that I was only thinking about the financial side of free and had forgotten about the functional aspects of free!

XML sitemap showing ugly URLS instead of URL paths in Drupal

If you see all the ugly URL's in your sitemap.xml, like /node/123, but have URL paths specified for those nodes, here is how to fix the problem:

  1. Deactivate "XML Sitemap Node" module. Your sitemap.xml will now not contain nodes anymore.
  2. Uninstall "XML Sitemap Node" module. This will remove all nodes from the sitemap.
  3. Activate "XML Sitemap Node" module. This will read all nodes and place them correctly into the sitemap.

It's that simple, but can make a huge difference, because you need to let search engines know how to access nodes based on your URL paths rather then the node number. Read more about SEO.

Making Linux commands shorter

Here are a few ways to shorten your Linux/UNIX/*BSD commands. Keep in mind that some short commands are less readable by others.

Long version Short version Characters won Application
cd $HOME cd 6 Shell
cat file | grep -v some | grep -v thing grep -vE 'some|thing' file 13 Shell
sort file | uniq sort -u file 4 Shell
:wq! :x 2 vi
boot bsd bsd 5 OpenBSD bootloader
grep -v '^#' file | grep -v '^$' grep -vE '^#|^$' file 11 Shell
Syndicate content