Change Permissions or Ownership of Files or Directories Recursively

So I am always looking for the way to change all files or directories in a directory to a certain set of permissions.  Here are the following shell commands that you can use to accomplish it. chmod files or directories recursively Shell # For Directories find ./ -type...

Checking Active Processes

So this is a way to get a list of processes running for a specified user pstree -apu | grep username or ps aux | grep username 12345 pstree -apu | grep username or ps aux | grep username...

Delete a files contents through bash

So I was looking for a way to automatically overwrite a log file utilizing the command prompt and a cron job.  So this is how it can be accomplished. overwrite a file PHP cat /dev/null > /location/of/file.txt 1 cat /dev/null > /location/of/file.txt By adding...

Disable PHP File Execution via .htaccess

Here is the code that you can put in your .htaccess file within a folder to disable php file execution.  It is very useful in the WordPress's wp-content/uploads directory for making sure files that get uploaded are not executable. Stop PHP File Execution <Files...

Find Files by Size

The below command is set to search the home directory of the server for files that are larger than 200M into a new text file large_files. Find Files find /home/ -xdev -type f -size +200M -exec ls -la {} \; | sort -n > large_files 1 find /home/ -xdev -type f -size...