March 22, 2015

Some Important directory/file commands?

Number of people are confused about how to change the directory or file permissions recursively using CLI in linux. So here is answer

To change all the directories to 755 or you can say to -rwxr-xr-x under any directory,

find /< path-to-directory > -type d -exec chmod 755 {} \;

Here means you have to give the absolute path to the folder under which you want to set the permissions recursively.

In the same way you can use the following command to change permissions of files to 644 or -rw-r–r–

find /< path-to-files-directory > -type f -exec chmod 644 {} \;

These days many programmers use the version control systems to manage the different versions of same project at same time. But the main issue to remove the version control files when move from dev to production server such as svn files. So in case you are facing the same issue use the following command to remove the svn files, move to the required folder and run following command:

find . -type d -name .svn -exec rm -rf {} \;

Leave a Reply