Friday, November 16, 2007

Changing the permissions only of the subdirectories in Linux

I use Linux as the operating system of my home computer for quite a long time now. I think it is a little bit more than 2 years, but I must confess I haven't mastered the command line yet. I do use the command line quite a lot, but my memory becomes weaker, so if I used something on the command line once or twice, I definitely don't remember it after some time. I thought of a solution to my problem. I will keep all these small tricks here, online, in my blog, as a "linuxlog"!

Well, today's bite sized tip is about changing the permissions of all the subdirectories of a directory, recursively, but only the directories and not the files within! The solution requires the use of the tools and find, xargs and chmod.

Here is the line you need:
find /path/to/directory/ -type d -print0 | xargs -0 chmod 755

First we use find to find all the subdirectories (-type d) within the directory (/path/to/directory/). The switch -print0 is used in order to separate the results with the null character instead of a new line. This way our command will work correctly even for directories with spaces in their name.

The result of the find is passed to xargs, which passed to chmod the results one by one. The switch -0 is used to inform xargs that the input items are separated by the null character and not a new line.

xargs executes the statement chmod 755 for every result that is read from find.

That's my first tip for the command line. Until next time, enjoy your linux operating system!

Monday, November 05, 2007


This is a videoclip shot and edited by me. It is about a robotic hover and an experiment that was done in London Knowledge Lab to find out whether the small robot does its job well! You can see the video at facebook of Dikaios who uploaded the video. You can download the video from here.

The music is from the Podsafe music network by amb26 and the song is called Anticipated. For more information visit