chmod directories/files using command line

Filed Under (Ubuntu) by khawaib on 21-05-2010

Tagged Under : , , ,

//Following command will set the permission for all directories only:
find . -type d -exec chmod 755 {} \;
//Following command will set the permission for all files only:
find . -type f -exec chmod 644 {} \;
//To only apply chmod to files with names matching a specified pattern:
find . -type f -name '*.htm*' -exec chmod 644 {} \;
//To restrict to an owner you can also do:
find . -type d -user fileowner -exec chmod 0755 {} \;
//Changing files of only a specific type/extension is:
find ./ -name *.pdf -exec chmod 755 {} \;

Useful Command-Line Tips

Filed Under (Ubuntu) by khawaib on 11-05-2010

Tagged Under :

Change directories command
For relatives path:

cd ../relative/path/directory/file

For absolute paths:

cd /absolute/path/directory/file

Go to home directry from any location: cd~

Listing
To list files of a direcroty
For relatives path:

ls ../relative/path/directory/file

For absolute paths:

ls /absolute/path/directory/file

Options:
-l for list
-A show hidden files

Show current directory

pwd

Copy files from one location to another

cp /files/to/copy /directory/to/copy/to/  

Finding help:

cp --help

for detailed help type man

man mysqldump
[/php]
[php]