This post will show how to change permission for directories & files via command line on Linux based operating system.

Changing permission for single directory

chmod 777 directory-name/

Changing permission for single file

chmod 644 file-name.txt

Change permission recursively

This command will also change all subfolder & files in directory name images/.

chmod -R 755 images/

Change only files in a directory & subdirectory

find . -type f -exec chmod 644 {} +

Change only directories in a directory & subdirectory

find . -type d -exec chmod 755 {} +